Documentation
¶
Index ¶
- Constants
- Variables
- func CopyRoot(ctx context.Context, bucket objstore.Bucket, sourcePrefix, targetPrefix string, ...) error
- type AutoCheckpointer
- func (a *AutoCheckpointer) CheckpointOnShutdown(ctx context.Context, tip uint64) error
- func (a *AutoCheckpointer) ConfigurePublication(eligible func() bool, publish func(context.Context, *Checkpoint) error)
- func (a *AutoCheckpointer) ConfigurePublisher(owner string, floor func() uint64, advance func(context.Context, uint64) error)
- func (a *AutoCheckpointer) ConfigureTail(bytes func() int64, budget int64)
- func (a *AutoCheckpointer) Start(ctx context.Context, tipFunc func() uint64, before func(context.Context) error)
- func (a *AutoCheckpointer) Stop()
- type Block
- type Checkpoint
- type File
- type Manager
- func (m *Manager) AcquireGenerationClaim(ctx context.Context, owner string, index uint64, lease time.Duration) (*PublisherClaim, error)
- func (m *Manager) AcquirePublisherClaim(ctx context.Context, owner string, minExclusive uint64, lease time.Duration) (*PublisherClaim, error)
- func (m *Manager) BindPublisherClaim(ctx context.Context, claim *PublisherClaim, index uint64, root [32]byte, ...) (*PublisherClaim, error)
- func (m *Manager) Cleanup(ctx context.Context, keep int) error
- func (m *Manager) CreateFiles(ctx context.Context, claim *PublisherClaim, sources []Source, index uint64) (*Checkpoint, error)
- func (m *Manager) DownloadAndVerifyRootFiles(ctx context.Context, root *Checkpoint, dir string) ([]File, error)
- func (m *Manager) DownloadRootFiles(ctx context.Context, index uint64, rootHash [32]byte, dir string) ([]File, error)
- func (m *Manager) GarbageCollect(ctx context.Context, retain map[[32]byte]struct{}, keep int, ...) error
- func (m *Manager) GarbageCollectFrom(ctx context.Context, retain map[[32]byte]struct{}, keep int, floor uint64, ...) error
- func (m *Manager) Latest() *Checkpoint
- func (m *Manager) Load(ctx context.Context) error
- func (m *Manager) OpenRoot(ctx context.Context, index uint64, rootHash [32]byte) (*Checkpoint, error)
- func (m *Manager) PinRecoveryRoot(ctx context.Context, root *Checkpoint, owner string, lease time.Duration) (*RecoveryPin, error)
- func (m *Manager) PromoteCertifiedCurrent(ctx context.Context, root *Checkpoint) error
- func (m *Manager) ReleasePublisherClaim(ctx context.Context, claim *PublisherClaim) error
- func (m *Manager) RenewPublisherClaim(ctx context.Context, claim *PublisherClaim, lease time.Duration) (*PublisherClaim, error)
- func (m *Manager) ValidatePublisherClaim(ctx context.Context, owner string, index uint64, root [32]byte) error
- func (m *Manager) Verify(ctx context.Context, index uint64, rootHash, state [32]byte) error
- type PublisherClaim
- type RecoveryPin
- type Source
Constants ¶
const ( RoleSQLite = "sqlite" RoleGraphData = "graph-data" )
Variables ¶
var ( ErrPublisherBusy = errors.New("checkpoint publisher is active") ErrPublisherFenced = errors.New("checkpoint publisher was fenced") )
var ErrStaleCheckpoint = errors.New("stale checkpoint candidate")
Functions ¶
Types ¶
type AutoCheckpointer ¶
type AutoCheckpointer struct {
// contains filtered or unexported fields
}
AutoCheckpointer automatically creates checkpoints.
func NewAutoCheckpointer ¶
func NewAutoCheckpointer(manager *Manager, material *materializer.Materializer, interval int64, duration time.Duration) *AutoCheckpointer
NewAutoCheckpointer creates a new auto checkpointer.
func (*AutoCheckpointer) CheckpointOnShutdown ¶
func (a *AutoCheckpointer) CheckpointOnShutdown(ctx context.Context, tip uint64) error
CheckpointOnShutdown creates a checkpoint during shutdown.
func (*AutoCheckpointer) ConfigurePublication ¶
func (a *AutoCheckpointer) ConfigurePublication(eligible func() bool, publish func(context.Context, *Checkpoint) error)
func (*AutoCheckpointer) ConfigurePublisher ¶
func (*AutoCheckpointer) ConfigureTail ¶
func (a *AutoCheckpointer) ConfigureTail(bytes func() int64, budget int64)
func (*AutoCheckpointer) Start ¶
func (a *AutoCheckpointer) Start(ctx context.Context, tipFunc func() uint64, before func(context.Context) error)
Start starts the automatic checkpoint loop.
func (*AutoCheckpointer) Stop ¶
func (a *AutoCheckpointer) Stop()
Stop stops the automatic checkpoint loop.
type Checkpoint ¶
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
func NewManager ¶
func NewManagerFromEnv ¶
NewManagerFromEnv creates a checkpoint manager from environment.
func (*Manager) AcquireGenerationClaim ¶ added in v0.14.0
func (m *Manager) AcquireGenerationClaim(ctx context.Context, owner string, index uint64, lease time.Duration) (*PublisherClaim, error)
AcquireGenerationClaim reserves one externally fenced recovery index. Unlike consensus publishers it never advances that index on a retry. A generation claim may only succeed in an empty checkpoint namespace or after an earlier claim for the same operation has expired.
func (*Manager) AcquirePublisherClaim ¶
func (*Manager) BindPublisherClaim ¶
func (m *Manager) BindPublisherClaim(ctx context.Context, claim *PublisherClaim, index uint64, root [32]byte, lease time.Duration) (*PublisherClaim, error)
func (*Manager) CreateFiles ¶
func (m *Manager) CreateFiles(ctx context.Context, claim *PublisherClaim, sources []Source, index uint64) (*Checkpoint, error)
func (*Manager) DownloadAndVerifyRootFiles ¶
func (m *Manager) DownloadAndVerifyRootFiles(ctx context.Context, root *Checkpoint, dir string) ([]File, error)
DownloadAndVerifyRootFiles writes and hashes a root that was already opened. A successful download is immediately reusable by Verify without another object-store read.
func (*Manager) DownloadRootFiles ¶
func (*Manager) GarbageCollect ¶
func (*Manager) GarbageCollectFrom ¶
func (m *Manager) GarbageCollectFrom(ctx context.Context, retain map[[32]byte]struct{}, keep int, floor uint64, grace time.Duration) error
GarbageCollectFrom retains every root at or above floor. The shared archive recovery base is authoritative for this lower bound.
func (*Manager) Latest ¶
func (m *Manager) Latest() *Checkpoint
func (*Manager) PinRecoveryRoot ¶
func (m *Manager) PinRecoveryRoot(ctx context.Context, root *Checkpoint, owner string, lease time.Duration) (*RecoveryPin, error)
PinRecoveryRoot publishes a short-lived, renewable recovery reference under the same maintenance lease used by GC, closing the pin-registration race.
func (*Manager) PromoteCertifiedCurrent ¶
func (m *Manager) PromoteCertifiedCurrent(ctx context.Context, root *Checkpoint) error
PromoteCertifiedCurrent advances CURRENT only after the checkpoint seal is decided. Conditional writes make the pointer monotonic across stale writers.
func (*Manager) ReleasePublisherClaim ¶
func (m *Manager) ReleasePublisherClaim(ctx context.Context, claim *PublisherClaim) error
func (*Manager) RenewPublisherClaim ¶
func (m *Manager) RenewPublisherClaim(ctx context.Context, claim *PublisherClaim, lease time.Duration) (*PublisherClaim, error)
func (*Manager) ValidatePublisherClaim ¶
type PublisherClaim ¶
type PublisherClaim struct {
ConfigID uint `json:"config_id"`
Generation uint64 `json:"generation"`
OwnerID string `json:"owner_id"`
Purpose string `json:"purpose,omitempty"`
LeaseUntilMS int64 `json:"lease_until_unix_ms"`
ReservedIndex uint64 `json:"reserved_index"`
BoundIndex uint64 `json:"bound_index,omitempty"`
RootHash string `json:"root_hash,omitempty"`
// contains filtered or unexported fields
}
type RecoveryPin ¶
type RecoveryPin struct {
// contains filtered or unexported fields
}
RecoveryPin keeps an immutable checkpoint root and its content-addressed blocks live while a node installs that root.
func (*RecoveryPin) Root ¶
func (p *RecoveryPin) Root() (*Checkpoint, error)
Root returns the immutable descriptor captured when this recovery pin was committed. It remains usable if a stale GC later removes the canonical root object after the recovery has selected it.