Documentation
¶
Overview ¶
package: adapter/sequencer/dev / testkit job: the dev Sequencer's contribution — steps 2–5 (filling, completing, verifying, persisting) behind the ranke.Contribution contract type: adapter limits: one contribution at a time, filled from one goroutine; merging is step 6 and belongs to the Sequencer (-> dev.go)
package: adapter/sequencer/dev / testkit type: adapter job: a blocking reference Sequencer for tests and development — the sole writer that advances a Ranke-Archive by driving the paper's six steps one contribution at a time limits: a merge holds the lock end to end, so callers queue; manages named branches without propagating between them (paper 2's cross-branch merge); mints from the injected Clock. NOT for production (-> adapter/sequencer/concurrent).
Index ¶
- type Clock
- type Sequencer
- func (s *Sequencer) GetArchive(ctx context.Context) (ranke.Archive, error)
- func (s *Sequencer) GetContributor() ranke.Contributor
- func (s *Sequencer) Merge(ctx context.Context, mc ranke.MergableContribution) (ranke.Receipt, error)
- func (s *Sequencer) NewContribution(_ context.Context, opts ...ranke.ContributionOption) (ranke.Contribution, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Clock ¶
Clock is the deterministic time source for the claims the Sequencer mints, local to this adapter so it depends only on ranke. Tick returns now, then advances; one Clock shared with the caller keeps a whole run monotonic.
type Sequencer ¶
type Sequencer struct {
// contains filtered or unexported fields
}
Sequencer is the reference Ranke-Archive write path (RankeDB §Sequencer): the single writer advancing the head k → k′ by merging a contribution, running the six steps serially in one blocking AddClaims call. Safe for concurrent use, bought by queueing — a merge runs alone (-> adapter/sequencer/concurrent for parallel).
func NewSequencer ¶
func NewSequencer(ctx context.Context, u ranke.Universe, hist ranke.History, self ranke.Contributor, clock Clock) (*Sequencer, error)
NewSequencer bootstraps a fresh archive over u, storing the key-carrying self contributor and minting the empty contribution/branches claim whose id is the archive head k₀ (foundation §Ranke-Archive), recorded in history.
func (*Sequencer) GetArchive ¶
GetArchive returns the immutable snapshot RA_k at the current head, read under the lock and built outside it, so a reader neither tears nor waits on a merge's I/O.
func (*Sequencer) GetContributor ¶
func (s *Sequencer) GetContributor() ranke.Contributor
GetContributor returns the contributor the Sequencer signs branch advances with.
func (*Sequencer) Merge ¶
func (s *Sequencer) Merge(ctx context.Context, mc ranke.MergableContribution) (ranke.Receipt, error)
Merge is step 6: it folds each named branch's head in, mints one branch table restating them all, records the revision, and publishes the new archive head. The lock covers the whole step, since it derives the next head from the one it read.
func (*Sequencer) NewContribution ¶
func (s *Sequencer) NewContribution(_ context.Context, opts ...ranke.ContributionOption) (ranke.Contribution, error)
NewContribution is step 1: it captures the base (k, t) and returns a contribution to fill, whose claims name the branches they join. Head and time come together, so the base is a pair that held at one instant.