Help us shape the future of Go! Take the 2026 Go Developer Survey

packfile

package
v0.57.21 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 2, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const BloomFormatVersionV1 uint32 = 1

BloomFormatVersionV1 identifies the current serialized Hydra BloomFilter bytes carried in PackfileEntry.bloom_filter.

Variables

This section is empty.

Functions

func BlockKey

func BlockKey(h *hash.Hash) []byte

BlockKey returns the pack index key of a block: the protobuf encoding of its hash. Bloom filters hold the same keys.

func DecodeBlockValue

func DecodeBlockValue(key, value []byte) (*block.BlockRef, *block.StoredBlock, error)

DecodeBlockValue decodes a pack entry: the key is the BlockKey of the block hash and the value is the encoded block.BlockObject of the block's bytes and refs. It verifies the bytes against the key.

func ParseBlockKey

func ParseBlockKey(key []byte) (*hash.Hash, error)

ParseBlockKey parses a pack index key into the block hash it names.

Types

type CatalogPuller

type CatalogPuller interface {
	// SyncPull returns the catalog page after since. Since zero starts from the
	// beginning.
	SyncPull(ctx context.Context, resourceID string, since uint64) (*PullResponse, error)
}

CatalogPuller reads one page of a block store catalog after a cursor.

type PackReplacementEvent

type PackReplacementEvent struct {

	// Sequence is the monotonic cursor anchor assigned to the replacement event.
	Sequence uint64 `protobuf:"varint,1,opt,name=sequence,proto3" json:"sequence,omitempty"`
	// ReplacedPackIds is the set of packs removed from the active manifest.
	ReplacedPackIds []string `protobuf:"bytes,2,rep,name=replaced_pack_ids,json=replacedPackIds,proto3" json:"replacedPackIds,omitempty"`
	// ReplacementPackIds is the set of packs added by the same replacement.
	ReplacementPackIds []string `protobuf:"bytes,3,rep,name=replacement_pack_ids,json=replacementPackIds,proto3" json:"replacementPackIds,omitempty"`
	// contains filtered or unexported fields
}

PackReplacementEvent describes one atomic replacement sequence.

func (*PackReplacementEvent) CloneMessageVT

func (*PackReplacementEvent) CloneVT

func (*PackReplacementEvent) EqualMessageVT

func (this *PackReplacementEvent) EqualMessageVT(thatMsg any) bool

func (*PackReplacementEvent) EqualVT

func (this *PackReplacementEvent) EqualVT(that *PackReplacementEvent) bool

func (*PackReplacementEvent) GetReplacedPackIds

func (x *PackReplacementEvent) GetReplacedPackIds() []string

func (*PackReplacementEvent) GetReplacementPackIds

func (x *PackReplacementEvent) GetReplacementPackIds() []string

func (*PackReplacementEvent) GetSequence

func (x *PackReplacementEvent) GetSequence() uint64

func (*PackReplacementEvent) MarshalJSON

func (x *PackReplacementEvent) MarshalJSON() ([]byte, error)

MarshalJSON marshals the PackReplacementEvent to JSON.

func (*PackReplacementEvent) MarshalProtoJSON

func (x *PackReplacementEvent) MarshalProtoJSON(s *json.MarshalState)

MarshalProtoJSON marshals the PackReplacementEvent message to JSON.

func (*PackReplacementEvent) MarshalProtoText

func (x *PackReplacementEvent) MarshalProtoText() string

func (*PackReplacementEvent) MarshalToSizedBufferVT

func (m *PackReplacementEvent) MarshalToSizedBufferVT(dAtA []byte) (int, error)

func (*PackReplacementEvent) MarshalToVT

func (m *PackReplacementEvent) MarshalToVT(dAtA []byte) (int, error)

func (*PackReplacementEvent) MarshalVT

func (m *PackReplacementEvent) MarshalVT() (dAtA []byte, err error)

func (*PackReplacementEvent) ProtoMessage

func (*PackReplacementEvent) ProtoMessage()

func (*PackReplacementEvent) Reset

func (x *PackReplacementEvent) Reset()

func (*PackReplacementEvent) SizeVT

func (m *PackReplacementEvent) SizeVT() (n int)

func (*PackReplacementEvent) String

func (x *PackReplacementEvent) String() string

func (*PackReplacementEvent) UnmarshalJSON

func (x *PackReplacementEvent) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals the PackReplacementEvent from JSON.

func (*PackReplacementEvent) UnmarshalProtoJSON

func (x *PackReplacementEvent) UnmarshalProtoJSON(s *json.UnmarshalState)

UnmarshalProtoJSON unmarshals the PackReplacementEvent message from JSON.

func (*PackReplacementEvent) UnmarshalVT

func (m *PackReplacementEvent) UnmarshalVT(dAtA []byte) error

type PackfileEntry

type PackfileEntry struct {

	// Id is the v1 packfile identifier.
	Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	// BloomFilter is the serialized bloom filter for the packfile.
	BloomFilter []byte `protobuf:"bytes,2,opt,name=bloom_filter,json=bloomFilter,proto3" json:"bloomFilter,omitempty"`
	// BlockCount is the number of blocks in the packfile.
	BlockCount uint64 `protobuf:"varint,3,opt,name=block_count,json=blockCount,proto3" json:"blockCount,omitempty"`
	// SizeBytes is the size of the packfile in bytes.
	SizeBytes uint64 `protobuf:"varint,4,opt,name=size_bytes,json=sizeBytes,proto3" json:"sizeBytes,omitempty"`
	// CreatedAt is the time the packfile was created.
	CreatedAt *timestamppb.Timestamp `protobuf:"bytes,5,opt,name=created_at,json=createdAt,proto3" json:"createdAt,omitempty"`
	// BloomFormatVersion is the encoding version of the bloom_filter bytes.
	// Version 1 means the current serialized Hydra BloomFilter bytes; future
	// bloom layouts add new versions, not mutations of v1. Required on every
	// entry; cloud rejects pushes whose advertised version is not in its
	// accepted-versions allowlist.
	BloomFormatVersion uint32 `protobuf:"varint,6,opt,name=bloom_format_version,json=bloomFormatVersion,proto3" json:"bloomFormatVersion,omitempty"`
	// Sequence is the monotonic cursor anchor assigned by the cloud DO single
	// writer at insert time. Pull cursors advance over sequence > since. Local
	// entries not yet pushed carry 0.
	Sequence uint64 `protobuf:"varint,7,opt,name=sequence,proto3" json:"sequence,omitempty"`
	// SupersededBy is the replacement packfile ID; empty when the row is
	// current.
	SupersededBy string `protobuf:"bytes,8,opt,name=superseded_by,json=supersededBy,proto3" json:"supersededBy,omitempty"`
	// SupersededAt is the time supersession was recorded; absent when the
	// row is current.
	SupersededAt *timestamppb.Timestamp `protobuf:"bytes,9,opt,name=superseded_at,json=supersededAt,proto3" json:"supersededAt,omitempty"`
	// contains filtered or unexported fields
}

PackfileEntry describes a single packfile in the manifest.

func (*PackfileEntry) CloneMessageVT

func (m *PackfileEntry) CloneMessageVT() protobuf_go_lite.CloneMessage

func (*PackfileEntry) CloneVT

func (m *PackfileEntry) CloneVT() *PackfileEntry

func (*PackfileEntry) EqualMessageVT

func (this *PackfileEntry) EqualMessageVT(thatMsg any) bool

func (*PackfileEntry) EqualVT

func (this *PackfileEntry) EqualVT(that *PackfileEntry) bool

func (*PackfileEntry) GetBlockCount

func (x *PackfileEntry) GetBlockCount() uint64

func (*PackfileEntry) GetBloomFilter

func (x *PackfileEntry) GetBloomFilter() []byte

func (*PackfileEntry) GetBloomFormatVersion

func (x *PackfileEntry) GetBloomFormatVersion() uint32

func (*PackfileEntry) GetCreatedAt

func (x *PackfileEntry) GetCreatedAt() *timestamppb.Timestamp

func (*PackfileEntry) GetId

func (x *PackfileEntry) GetId() string

func (*PackfileEntry) GetSequence

func (x *PackfileEntry) GetSequence() uint64

func (*PackfileEntry) GetSizeBytes

func (x *PackfileEntry) GetSizeBytes() uint64

func (*PackfileEntry) GetSupersededAt

func (x *PackfileEntry) GetSupersededAt() *timestamppb.Timestamp

func (*PackfileEntry) GetSupersededBy

func (x *PackfileEntry) GetSupersededBy() string

func (*PackfileEntry) MarshalJSON

func (x *PackfileEntry) MarshalJSON() ([]byte, error)

MarshalJSON marshals the PackfileEntry to JSON.

func (*PackfileEntry) MarshalProtoJSON

func (x *PackfileEntry) MarshalProtoJSON(s *json.MarshalState)

MarshalProtoJSON marshals the PackfileEntry message to JSON.

func (*PackfileEntry) MarshalProtoText

func (x *PackfileEntry) MarshalProtoText() string

func (*PackfileEntry) MarshalToSizedBufferVT

func (m *PackfileEntry) MarshalToSizedBufferVT(dAtA []byte) (int, error)

func (*PackfileEntry) MarshalToVT

func (m *PackfileEntry) MarshalToVT(dAtA []byte) (int, error)

func (*PackfileEntry) MarshalVT

func (m *PackfileEntry) MarshalVT() (dAtA []byte, err error)

func (*PackfileEntry) ProtoMessage

func (*PackfileEntry) ProtoMessage()

func (*PackfileEntry) Reset

func (x *PackfileEntry) Reset()

func (*PackfileEntry) SizeVT

func (m *PackfileEntry) SizeVT() (n int)

func (*PackfileEntry) String

func (x *PackfileEntry) String() string

func (*PackfileEntry) UnmarshalJSON

func (x *PackfileEntry) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals the PackfileEntry from JSON.

func (*PackfileEntry) UnmarshalProtoJSON

func (x *PackfileEntry) UnmarshalProtoJSON(s *json.UnmarshalState)

UnmarshalProtoJSON unmarshals the PackfileEntry message from JSON.

func (*PackfileEntry) UnmarshalVT

func (m *PackfileEntry) UnmarshalVT(dAtA []byte) error

type PullResponse

type PullResponse struct {

	// Entries is the list of packfile entries.
	Entries []*PackfileEntry `protobuf:"bytes,1,rep,name=entries,proto3" json:"entries,omitempty"`
	// ReplacementEvents is the list of atomic replacement events.
	ReplacementEvents []*PackReplacementEvent `protobuf:"bytes,2,rep,name=replacement_events,json=replacementEvents,proto3" json:"replacementEvents,omitempty"`
	// LatestSequence is the current monotonic sequence head for the block store,
	// even when Entries and ReplacementEvents are empty for an up-to-date pull.
	LatestSequence uint64 `protobuf:"varint,3,opt,name=latest_sequence,json=latestSequence,proto3" json:"latestSequence,omitempty"`
	// More is set when entries or events after this page remain below
	// LatestSequence.
	More bool `protobuf:"varint,4,opt,name=more,proto3" json:"more,omitempty"`
	// Restart is set when the server no longer holds the history after the
	// requested cursor. The page then starts a full pull from sequence zero,
	// and the reader drops every pulled pack the full pull does not list.
	Restart bool `protobuf:"varint,5,opt,name=restart,proto3" json:"restart,omitempty"`
	// contains filtered or unexported fields
}

PullResponse is one page of a block store catalog pull. A page holds every entry and replacement event at each sequence it covers, so the greatest sequence on the page is the cursor for the next page.

func PullCatalog

func PullCatalog(ctx context.Context, puller CatalogPuller, resourceID string) (*PullResponse, error)

PullCatalog reads every page of a block store catalog from the beginning and returns the pages merged into one response. A restarted page discards the pages read before it.

func (*PullResponse) CloneMessageVT

func (m *PullResponse) CloneMessageVT() protobuf_go_lite.CloneMessage

func (*PullResponse) CloneVT

func (m *PullResponse) CloneVT() *PullResponse

func (*PullResponse) EqualMessageVT

func (this *PullResponse) EqualMessageVT(thatMsg any) bool

func (*PullResponse) EqualVT

func (this *PullResponse) EqualVT(that *PullResponse) bool

func (*PullResponse) GetEntries

func (x *PullResponse) GetEntries() []*PackfileEntry

func (*PullResponse) GetLatestSequence

func (x *PullResponse) GetLatestSequence() uint64

func (*PullResponse) GetMore

func (x *PullResponse) GetMore() bool

func (*PullResponse) GetReplacementEvents

func (x *PullResponse) GetReplacementEvents() []*PackReplacementEvent

func (*PullResponse) GetRestart

func (x *PullResponse) GetRestart() bool

func (*PullResponse) MarshalJSON

func (x *PullResponse) MarshalJSON() ([]byte, error)

MarshalJSON marshals the PullResponse to JSON.

func (*PullResponse) MarshalProtoJSON

func (x *PullResponse) MarshalProtoJSON(s *json.MarshalState)

MarshalProtoJSON marshals the PullResponse message to JSON.

func (*PullResponse) MarshalProtoText

func (x *PullResponse) MarshalProtoText() string

func (*PullResponse) MarshalToSizedBufferVT

func (m *PullResponse) MarshalToSizedBufferVT(dAtA []byte) (int, error)

func (*PullResponse) MarshalToVT

func (m *PullResponse) MarshalToVT(dAtA []byte) (int, error)

func (*PullResponse) MarshalVT

func (m *PullResponse) MarshalVT() (dAtA []byte, err error)

func (*PullResponse) NextCursor

func (r *PullResponse) NextCursor() uint64

NextCursor returns the cursor that continues a pull after this page: the greatest sequence on the page, or zero when the page is empty.

func (*PullResponse) ProtoMessage

func (*PullResponse) ProtoMessage()

func (*PullResponse) Reset

func (x *PullResponse) Reset()

func (*PullResponse) SizeVT

func (m *PullResponse) SizeVT() (n int)

func (*PullResponse) String

func (x *PullResponse) String() string

func (*PullResponse) UnmarshalJSON

func (x *PullResponse) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals the PullResponse from JSON.

func (*PullResponse) UnmarshalProtoJSON

func (x *PullResponse) UnmarshalProtoJSON(s *json.UnmarshalState)

UnmarshalProtoJSON unmarshals the PullResponse message from JSON.

func (*PullResponse) UnmarshalVT

func (m *PullResponse) UnmarshalVT(dAtA []byte) error

type PushResponse

type PushResponse struct {

	// PackId is the packfile identifier.
	PackId string `protobuf:"bytes,1,opt,name=pack_id,json=packId,proto3" json:"packId,omitempty"`
	// AlreadyExists indicates the packfile already existed.
	AlreadyExists bool `protobuf:"varint,2,opt,name=already_exists,json=alreadyExists,proto3" json:"alreadyExists,omitempty"`
	// SizeBytes is the size of the packfile in bytes.
	SizeBytes uint64 `protobuf:"varint,3,opt,name=size_bytes,json=sizeBytes,proto3" json:"sizeBytes,omitempty"`
	// contains filtered or unexported fields
}

PushResponse is the response to a push request.

func (*PushResponse) CloneMessageVT

func (m *PushResponse) CloneMessageVT() protobuf_go_lite.CloneMessage

func (*PushResponse) CloneVT

func (m *PushResponse) CloneVT() *PushResponse

func (*PushResponse) EqualMessageVT

func (this *PushResponse) EqualMessageVT(thatMsg any) bool

func (*PushResponse) EqualVT

func (this *PushResponse) EqualVT(that *PushResponse) bool

func (*PushResponse) GetAlreadyExists

func (x *PushResponse) GetAlreadyExists() bool

func (*PushResponse) GetPackId

func (x *PushResponse) GetPackId() string

func (*PushResponse) GetSizeBytes

func (x *PushResponse) GetSizeBytes() uint64

func (*PushResponse) MarshalJSON

func (x *PushResponse) MarshalJSON() ([]byte, error)

MarshalJSON marshals the PushResponse to JSON.

func (*PushResponse) MarshalProtoJSON

func (x *PushResponse) MarshalProtoJSON(s *json.MarshalState)

MarshalProtoJSON marshals the PushResponse message to JSON.

func (*PushResponse) MarshalProtoText

func (x *PushResponse) MarshalProtoText() string

func (*PushResponse) MarshalToSizedBufferVT

func (m *PushResponse) MarshalToSizedBufferVT(dAtA []byte) (int, error)

func (*PushResponse) MarshalToVT

func (m *PushResponse) MarshalToVT(dAtA []byte) (int, error)

func (*PushResponse) MarshalVT

func (m *PushResponse) MarshalVT() (dAtA []byte, err error)

func (*PushResponse) ProtoMessage

func (*PushResponse) ProtoMessage()

func (*PushResponse) Reset

func (x *PushResponse) Reset()

func (*PushResponse) SizeVT

func (m *PushResponse) SizeVT() (n int)

func (*PushResponse) String

func (x *PushResponse) String() string

func (*PushResponse) UnmarshalJSON

func (x *PushResponse) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals the PushResponse from JSON.

func (*PushResponse) UnmarshalProtoJSON

func (x *PushResponse) UnmarshalProtoJSON(s *json.UnmarshalState)

UnmarshalProtoJSON unmarshals the PushResponse message from JSON.

func (*PushResponse) UnmarshalVT

func (m *PushResponse) UnmarshalVT(dAtA []byte) error

Directories

Path Synopsis
Package order groups related blocks for physical packfile locality.
Package order groups related blocks for physical packfile locality.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL