Documentation
¶
Index ¶
- type Driver
- func (s *Driver) Ancestry(ctx context.Context, hash string) ([]*merkle.Node, error)
- func (s *Driver) AncestryChain(ctx context.Context, hash string) (*storage.Chain, error)
- func (s *Driver) AncestryChains(ctx context.Context, hashes []string) (map[string]*storage.Chain, error)
- func (s *Driver) Close() error
- func (s *Driver) Count() int
- func (s *Driver) CountSessions(_ context.Context, opts storage.ListOpts) (storage.SessionStats, error)
- func (s *Driver) Depth(ctx context.Context, hash string) (int, error)
- func (s *Driver) Get(_ context.Context, hash string) (*merkle.Node, error)
- func (s *Driver) GetByParent(_ context.Context, parentHash *string) ([]*merkle.Node, error)
- func (s *Driver) Has(_ context.Context, hash string) (bool, error)
- func (s *Driver) Leaves(_ context.Context) ([]*merkle.Node, error)
- func (s *Driver) List(_ context.Context) ([]*merkle.Node, error)
- func (s *Driver) ListSessions(_ context.Context, opts storage.ListOpts) (*storage.Page[*merkle.Node], error)
- func (s *Driver) Migrate(_ context.Context) error
- func (s *Driver) Put(_ context.Context, node *merkle.Node) (bool, error)
- func (s *Driver) Roots(ctx context.Context) ([]*merkle.Node, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Driver ¶
type Driver struct {
// contains filtered or unexported fields
}
Driver implements Storer using an in-memory map.
func (*Driver) Ancestry ¶
Ancestry returns the path from a node back to its root (node first, root last). See AncestryChain for a variant that also signals when the walk stopped at a missing parent.
func (*Driver) AncestryChain ¶ added in v0.4.0
AncestryChain walks the parent chain starting at hash and returns a Chain describing whether the walk reached a real root, stopped at a parent that is not present in this store, or was guarded out of a cycle.
func (*Driver) AncestryChains ¶ added in v0.4.0
func (s *Driver) AncestryChains(ctx context.Context, hashes []string) (map[string]*storage.Chain, error)
AncestryChains walks each input hash's ancestry and returns a Chain per starting hash. The in-memory driver has O(1) Get, so the batched ent fast path offers no benefit here — this is a straightforward loop over AncestryChain.
func (*Driver) CountSessions ¶ added in v0.4.0
func (s *Driver) CountSessions(_ context.Context, opts storage.ListOpts) (storage.SessionStats, error)
CountSessions returns aggregate counts for the slice of data matching opts. Pagination fields on opts are ignored.
func (*Driver) GetByParent ¶
GetByParent retrieves all nodes that have the provided parent. This is useful for determining where branching occurs.
func (*Driver) ListSessions ¶ added in v0.4.0
func (s *Driver) ListSessions(_ context.Context, opts storage.ListOpts) (*storage.Page[*merkle.Node], error)
ListSessions returns a page of leaf nodes (sessions), ordered by created_at descending then hash descending, optionally filtered by opts.