log

package
v0.1.1 Latest Latest
Warning

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

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

Documentation

Overview

Package log provides public interfaces for log operations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CreateLogParams

type CreateLogParams struct {
	SpaceDID   string
	Delegation delegation.Delegation
}

CreateLogParams contains parameters for creating a log with customer-delegated storage.

type LogResult

type LogResult struct {
	LogID string `json:"logId"`
}

LogResult contains the result of creating a log.

type LogService

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

func NewLogService

func NewLogService(tlogMgr *tlog.Manager, issuer *ucanPkg.Issuer) *LogService

func NewLogServiceWithConfig

func NewLogServiceWithConfig(cfg LogServiceConfig) *LogService

NewLogServiceWithConfig creates a LogService with full configuration for delegated storage.

func (*LogService) Append

func (s *LogService) Append(ctx context.Context, logID string, data []byte, dlg delegation.Delegation) (*tlog.AppendReceipt, error)

Append adds an entry to a log and returns the full append receipt. The delegation is used fresh on each request - not cached.

func (*LogService) CreateLog deprecated

func (s *LogService) CreateLog(ctx context.Context, logIdKey, accountIdKey ed25519.PublicKey) (*LogResult, error)

Deprecated: CreateLog is deprecated. Use CreateLogWithDelegation instead. This method is kept for backward compatibility with tests.

func (*LogService) CreateLogWithDelegation

func (s *LogService) CreateLogWithDelegation(ctx context.Context, params CreateLogParams) (*LogResult, error)

CreateLogWithDelegation creates a log with customer-provided Storacha space delegation.

func (*LogService) GetBlobFetcher

func (s *LogService) GetBlobFetcher(ctx context.Context, spaceDID string, dlg delegation.Delegation) (tlog.BlobFetcher, error)

GetBlobFetcher returns a client that can fetch blobs from a space. This is used for fetching delegations during revocation.

func (*LogService) GetLogMeta

func (s *LogService) GetLogMeta(ctx context.Context, logID string) (*tlog.LogMeta, error)

GetLogMeta retrieves metadata for a log.

func (*LogService) GetRevocations

func (s *LogService) GetRevocations(ctx context.Context, logID string) ([]types.RevocationEntry, error)

GetRevocations reads all revoked delegation CIDs from SQLite ONLY. Does NOT read from Tessera log - historical revocations from before this change will not be returned unless loaded via future admin endpoint.

func (*LogService) IsRevoked

func (s *LogService) IsRevoked(ctx context.Context, logID, delegationCID string) (bool, error)

IsRevoked checks if a specific delegation CID is revoked. Queries SQLite only - not Tessera.

func (*LogService) Read

func (s *LogService) Read(ctx context.Context, logID string, offset, limit int64) (*ReadResult, error)

Read retrieves entries from a log with pagination

func (*LogService) ReadCheckpoint

func (s *LogService) ReadCheckpoint(ctx context.Context, logID string) ([]byte, error)

ReadCheckpoint reads the latest checkpoint from a log (for tlog-tiles API)

func (*LogService) ReadEntryBundle

func (s *LogService) ReadEntryBundle(ctx context.Context, logID string, index uint64, partialWidth uint8) ([]byte, error)

ReadEntryBundle reads an entry bundle from a log (for tlog-tiles API)

func (*LogService) ReadTile

func (s *LogService) ReadTile(ctx context.Context, logID string, level, index uint64, partialWidth uint8) ([]byte, error)

ReadTile reads a Merkle tree tile from a log (for tlog-tiles API)

func (*LogService) Revoke

func (s *LogService) Revoke(ctx context.Context, logID, delegationCID string, dlg delegation.Delegation) error

Revoke adds a delegation CID to the revocation log and SQLite. Note: Only NEW revocations are written to SQLite. Existing Tessera revocations are not automatically migrated.

type LogServiceConfig

type LogServiceConfig struct {
	TlogManager  *tlog.Manager
	UcanIssuer   *ucanPkg.Issuer
	LogMetaStore *tlog.LogMetaStore
	ServiceDID   string
	StoreManager *sqlite.StoreManager
}

LogServiceConfig holds configuration for creating a LogService.

type ReadResult

type ReadResult struct {
	Entries [][]byte
	Total   int64
}

ReadResult contains read entries and metadata.

type Revocation

type Revocation struct {
	Target string
}

Revocation represents a revocation entry.

type Service

type Service interface {
	CreateLog(ctx context.Context, logIdKey, accountIdKey ed25519.PublicKey) (*LogResult, error)
	Append(ctx context.Context, logID string, data []byte) (uint64, error)
	Read(ctx context.Context, logID string, offset, limit int64) (*ReadResult, error)
	GetRevocations(ctx context.Context, logID string) ([]Revocation, error)
	Revoke(ctx context.Context, logID string, cid string) error
}

Service defines the interface for log operations.

Jump to

Keyboard shortcuts

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