Versions in this module Expand all Collapse all v2 v2.1.0 Nov 26, 2026 Changes in this version + var ErrInvalidProducerBatch = errors.New("invalid idempotent record batch") + var ErrInvalidProducerEpoch = errors.New("invalid producer epoch") + var ErrOutOfOrderSequence = errors.New("out of order producer sequence") + type IdempotentAppendResult struct + Duplicate bool type PartitionLog + func (l *PartitionLog) AppendIdempotentBatches(ctx context.Context, batches []RecordBatch) (*IdempotentAppendResult, error) v2.0.1 Nov 20, 2026 Changes in this version + var ErrAppendOutcomeUnknown = errors.New("append outcome is unknown") + var ErrConditionRejected = conditionRejectedError + var ErrConditionUnsupported = errors.New("conditional request not supported") + var ErrConditionalConflict = errors.New("conditional request conflict") + var ErrLogFenced = errors.New("partition log requires reload") + var ErrNotFound = errors.New("not found") + var ErrObjectStorage = errors.New("object storage request failed") + var ErrOffsetOutOfRange = errors.New("offset out of range") + var ErrPreconditionFailed = errors.New("precondition failed") + func CountRecordBatchMessages(recordSet []byte) int + func PatchRecordBatchBaseOffset(batch *RecordBatch, baseOffset int64) + type AppendResult struct + BaseOffset int64 + LastOffset int64 + type BucketChecker interface + CheckBucket func(ctx context.Context) error + type ByteRange struct + End int64 + Start int64 + type ConditionalIndexReplacer interface + DownloadIndexObject func(ctx context.Context, key string) (IndexObject, error) + UploadIndexIfMatch func(ctx context.Context, key string, body []byte, etag string) error + type ConditionalIndexWriter interface + UploadIndexIfAbsent func(ctx context.Context, key string, body []byte) error + type IndexBuilder struct + func NewIndexBuilder(interval int32) *IndexBuilder + func (b *IndexBuilder) BuildBytes() ([]byte, error) + func (b *IndexBuilder) Entries() []*IndexEntry + func (b *IndexBuilder) MaybeAdd(offset int64, position int32, batchMessages int32) + type IndexEntry struct + Offset int64 + Position int32 + func ParseIndex(data []byte) ([]*IndexEntry, error) + type IndexObject struct + Body []byte + ETag string + LastModified time.Time + type MemoryS3Client struct + func NewMemoryS3Client() *MemoryS3Client + func (m *MemoryS3Client) DeleteIndex(ctx context.Context, key string) error + func (m *MemoryS3Client) DeleteSegment(ctx context.Context, key string) error + func (m *MemoryS3Client) DownloadIndex(ctx context.Context, key string) ([]byte, error) + func (m *MemoryS3Client) DownloadIndexObject(ctx context.Context, key string) (IndexObject, error) + func (m *MemoryS3Client) DownloadSegment(ctx context.Context, key string, rng *ByteRange) ([]byte, error) + func (m *MemoryS3Client) EnsureBucket(ctx context.Context) error + func (m *MemoryS3Client) ListSegments(ctx context.Context, prefix string) ([]S3Object, error) + func (m *MemoryS3Client) UploadIndex(ctx context.Context, key string, body []byte) error + func (m *MemoryS3Client) UploadIndexIfAbsent(ctx context.Context, key string, body []byte) error + func (m *MemoryS3Client) UploadIndexIfMatch(ctx context.Context, key string, body []byte, etag string) error + func (m *MemoryS3Client) UploadSegment(ctx context.Context, key string, body []byte) error + type PartitionLog struct + func NewPartitionLog(namespace string, topic string, partition int32, startOffset int64, ...) *PartitionLog + func NewPartitionLogWithOptions(namespace string, topic string, partition int32, startOffset int64, ...) *PartitionLog + func (l *PartitionLog) AppendBatch(ctx context.Context, batch RecordBatch) (*AppendResult, error) + func (l *PartitionLog) AppendBatches(ctx context.Context, batches []RecordBatch, forceFlush bool) (*AppendResult, error) + func (l *PartitionLog) BufferedHighWatermark() int64 + func (l *PartitionLog) CheckOwnership() error + func (l *PartitionLog) DrainAndRelease(release func()) + func (l *PartitionLog) EarliestOffset() int64 + func (l *PartitionLog) Flush(ctx context.Context) error + func (l *PartitionLog) Read(ctx context.Context, offset int64, maxBytes int32) ([]byte, error) + func (l *PartitionLog) RestoreFromS3(ctx context.Context) (lastOffset int64, restoreErr error) + type PartitionLogConfig struct + Buffer WriteBufferConfig + CacheEnabled bool + Logger *slog.Logger + ReadAheadSegments int + Segment SegmentWriterConfig + type PartitionLogOptions struct + CheckOwnership func() error + CommitOffsets func(context.Context, *SegmentArtifact) error + type RecordBatch struct + BaseOffset int64 + Bytes []byte + LastOffsetDelta int32 + MessageCount int32 + func NewRecordBatchFromBytes(data []byte) (RecordBatch, error) + type RecoveredPartition struct + LastOffset int64 + Partition int32 + Segments []RecoveredSegment + SegmentsCopied int + type RecoveredSegment struct + BaseOffset int64 + CreatedAt time.Time + LastOffset int64 + Partition int32 + SizeBytes int64 + SourceIndex string + SourceKey string + TargetIndex string + TargetKey string + type S3Client interface + DeleteIndex func(ctx context.Context, key string) error + DeleteSegment func(ctx context.Context, key string) error + DownloadIndex func(ctx context.Context, key string) ([]byte, error) + DownloadSegment func(ctx context.Context, key string, rng *ByteRange) ([]byte, error) + EnsureBucket func(ctx context.Context) error + ListSegments func(ctx context.Context, prefix string) ([]S3Object, error) + UploadIndex func(ctx context.Context, key string, body []byte) error + UploadSegment func(ctx context.Context, key string, body []byte) error + func NewS3Client(ctx context.Context, cfg S3Config) (S3Client, error) + type S3Config struct + AccessKeyID string + Bucket string + Endpoint string + ForcePathStyle bool + KMSKeyARN string + MaxConnections int + Region string + SecretAccessKey string + SessionToken string + type S3Object struct + Key string + Size int64 + type SegmentArtifact struct + BaseOffset int64 + CreatedAt time.Time + IndexBytes []byte + LastOffset int64 + MessageCount int32 + RelativeIndex []*IndexEntry + SegmentBytes []byte + func BuildSegment(cfg SegmentWriterConfig, batches []RecordBatch, created time.Time) (*SegmentArtifact, error) + type SegmentWriterConfig struct + IndexIntervalMessages int32 + type TopicRecoveryConfig struct + Partitions []int32 + RestoreTo time.Time + SourceNamespace string + SourceTopic string + TargetNamespace string + TargetTopic string + type TopicRecoveryResult struct + Partitions []RecoveredPartition + RestoreTo time.Time + SegmentsCopied int + SourceNamespace string + SourceTopic string + TargetNamespace string + TargetTopic string + func RecoverTopicToTimestamp(ctx context.Context, s3 S3Client, cfg TopicRecoveryConfig) (*TopicRecoveryResult, error) + type WriteBuffer struct + func NewWriteBuffer(cfg WriteBufferConfig) *WriteBuffer + func (b *WriteBuffer) Append(batch RecordBatch) + func (b *WriteBuffer) Drain() []RecordBatch + func (b *WriteBuffer) RecordsFrom(offset int64, maxBytes int32) []byte + func (b *WriteBuffer) ShouldFlush(now time.Time) bool + func (b *WriteBuffer) Size() int + type WriteBufferConfig struct + FlushInterval time.Duration + MaxBatches int + MaxBytes int + MaxMessages int Other modules containing this package github.com/KafScale/platform