concurrent

package
v0.32.0 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2026 License: Apache-2.0 Imports: 7 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

package: adapter/sequencer/concurrent / adapter type: adapter job: the concurrent Sequencer — the paper's seven steps with 2–5 run in parallel off the sequencing thread, and steps 6–7 a serialised group commit folding a whole batch of contributions into ONE branch-table advance limits: single-process (the sequencing thread is a mutex, not consensus); its committed-id set grows with the archive; step 6 costs one closure test per contributed head, so a slow backend serialises there; no cross-branch merge, no limiting/expiry claims

package: adapter/sequencer/concurrent / adapter type: adapter job: the concurrent Sequencer's contribution stages — steps 2–5 (adding, completing, verifying, persisting), the work that runs OFF the sequencing thread limits: one contribution is not itself concurrency-safe for filling beyond the mutex here (fill it from one goroutine); merging is step 6 and lives with the Sequencer (-> concurrent.go)

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Clock

type Clock interface {
	Tick() time.Time
}

Clock stamps the claims the Sequencer mints. A local interface, so this adapter depends only on ranke; every Tick happens on the sequencing thread.

type Sequencer

type Sequencer struct {
	// contains filtered or unexported fields
}

Sequencer is the concurrent Ranke-Archive write path (RankeDB §Sequencer). Step 6 folds against the branch's LIVE head, not the base k a contribution opened at, so two contributions opened at one k both survive: the second consolidates the first's head alongside its own.

func NewSequencer

func NewSequencer(ctx context.Context, u ranke.Universe, loc ranke.BookmarkLocator, self ranke.Contributor, clock Clock) (*Sequencer, error)

NewSequencer opens the list loc names and takes its state from it, writing nothing: an archive comes into being through Found alone. self must carry the signing key every branch table and every bookmark it writes is signed with.

func (*Sequencer) BookmarkId added in v0.27.0

func (s *Sequencer) BookmarkId() ranke.Id

BookmarkId returns the id of the bookmark written at bootstrap.

func (*Sequencer) Found added in v0.29.0

func (s *Sequencer) Found(ctx context.Context, pubkey []byte, branch string) (ranke.Claim, error)

Found creates the archive: k₀ empty as `V-ARCHIVEHEIGHT` fixes, then k₁ binding branch to the first contributor. Only k₁ is bookmarked, so a crash part-way leaves no archive and a retry writes the same ids (paper 02 step 7).

func (*Sequencer) GetArchive

func (s *Sequencer) GetArchive(ctx context.Context) (ranke.Archive, error)

GetArchive returns the immutable snapshot RA_k at the current head, pinned to the head as read — so it is safe while contributions are in flight. Pre-genesis it refuses: there is no head, and an empty archive would be a fiction.

func (*Sequencer) GetContributor

func (s *Sequencer) GetContributor() ranke.Contributor

GetContributor returns the contributor branch advances are signed with.

func (*Sequencer) InGenesis added in v0.29.0

func (s *Sequencer) InGenesis() bool

InGenesis reports that no archive exists here yet, so Found is the one operation available (`ranke.ErrSequencerGenesis`).

func (*Sequencer) Merge

Merge is steps 6–7: it queues the contribution, then races the other writers for the sequencing thread. Enqueueing strictly before contending for the lock strands nothing — a caller holding it finds its entry committed or in its batch.

func (*Sequencer) NewContribution

func (s *Sequencer) NewContribution(ctx context.Context, opts ...ranke.ContributionOption) (ranke.Contribution, error)

NewContribution is step 1 and the only work the sequencing thread does per writer: it captures (k, t) for a contribution whose claims name their branches.

Jump to

Keyboard shortcuts

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