Documentation
¶
Index ¶
- Variables
- type LogRecord
- type LogStore
- func (s *LogStore) AddRevocation(ctx context.Context, delegationCID string) error
- func (s *LogStore) Close() error
- func (s *LogStore) CreateLogRecord(ctx context.Context, logDID string) error
- func (s *LogStore) DBPath() string
- func (s *LogStore) DequeuePendingCARs(ctx context.Context, limit int) ([]storage.PendingCAR, error)
- func (s *LogStore) EnqueueAndUpdateHead(ctx context.Context, logDID string, treeSize uint64, headCID string, ...) (int64, error)
- func (s *LogStore) GetHead(ctx context.Context, logDID string) (string, uint64, error)
- func (s *LogStore) GetLatestHeadCAR(ctx context.Context, logDID string) (headCID string, treeSize uint64, carData []byte, err error)
- func (s *LogStore) GetLogRecord(ctx context.Context, logDID string) (*LogRecord, error)
- func (s *LogStore) GetPendingBlobsForCAR(ctx context.Context, queueID int64) ([]storage.PendingBlob, error)
- func (s *LogStore) GetRevocations(ctx context.Context) ([]string, error)
- func (s *LogStore) GetTreeState(ctx context.Context, logDID string) (size uint64, root []byte, err error)
- func (s *LogStore) IsRevoked(ctx context.Context, delegationCID string) (bool, error)
- func (s *LogStore) ListLogDIDs(ctx context.Context) ([]string, error)
- func (s *LogStore) LogDID() string
- func (s *LogStore) MarkBlobFailed(ctx context.Context, id int64, errMsg string) error
- func (s *LogStore) MarkBlobUploaded(ctx context.Context, id int64) error
- func (s *LogStore) MarkCARFailed(ctx context.Context, id int64, errMsg string) error
- func (s *LogStore) MarkCARUploaded(ctx context.Context, id int64) error
- func (s *LogStore) SetLatestHeadCAR(ctx context.Context, logDID string, treeSize uint64, headCID string, ...) error
- func (s *LogStore) SetTreeState(ctx context.Context, logDID string, size uint64, root []byte) error
- type StoreManager
Constants ¶
This section is empty.
Variables ¶
var ( ErrNotFound = errors.New("not found") ErrHeadMismatch = errors.New("head mismatch") )
Functions ¶
This section is empty.
Types ¶
type LogStore ¶
type LogStore struct {
// contains filtered or unexported fields
}
func OpenLogStore ¶
func (*LogStore) AddRevocation ¶
AddRevocation marks a delegation as revoked. Idempotent.
func (*LogStore) CreateLogRecord ¶
func (*LogStore) DequeuePendingCARs ¶
DequeuePendingCARs atomically claims up to `limit` pending upload_queue entries (transitioning them from 'pending' to 'uploading') and returns them. Items in 'uploading' state are invisible to other workers.
func (*LogStore) EnqueueAndUpdateHead ¶
func (s *LogStore) EnqueueAndUpdateHead(ctx context.Context, logDID string, treeSize uint64, headCID string, carData []byte, blobs []storage.PendingBlob) (int64, error)
EnqueueAndUpdateHead atomically updates latest_head_car and inserts an upload_queue row. Returns the new queue entry ID.
func (*LogStore) GetHead ¶
GetHead returns the current head CID and tree size for a log. Reads from latest_head_car, which is updated synchronously on every append. Returns ("", 0, nil) if no record exists yet (log has never had an entry appended). Implements storage.StateStore interface.
func (*LogStore) GetLatestHeadCAR ¶
func (s *LogStore) GetLatestHeadCAR(ctx context.Context, logDID string) (headCID string, treeSize uint64, carData []byte, err error)
GetLatestHeadCAR retrieves the latest full-state CAR for a log. Returns ("", 0, nil, nil) if no record exists.
func (*LogStore) GetLogRecord ¶
func (*LogStore) GetPendingBlobsForCAR ¶
func (s *LogStore) GetPendingBlobsForCAR(ctx context.Context, queueID int64) ([]storage.PendingBlob, error)
GetPendingBlobsForCAR returns pending blobs for a given queue entry.
func (*LogStore) GetRevocations ¶
GetRevocations returns all revoked delegation CIDs.
func (*LogStore) GetTreeState ¶
func (s *LogStore) GetTreeState(ctx context.Context, logDID string) (size uint64, root []byte, err error)
GetTreeState retrieves the Merkle tree state for a log. Returns (0, nil, nil) if no tree state exists yet.
func (*LogStore) ListLogDIDs ¶
ListLogDIDs returns all log DIDs stored in this database.
func (*LogStore) MarkBlobFailed ¶
MarkBlobFailed records a blob upload error.
func (*LogStore) MarkBlobUploaded ¶
MarkBlobUploaded marks a blob as uploaded and nulls blob_data.
func (*LogStore) MarkCARFailed ¶
MarkCARFailed increments retry_count and records the error.
func (*LogStore) MarkCARUploaded ¶
MarkCARUploaded marks a queue entry as uploaded and nulls car_data.
type StoreManager ¶
type StoreManager struct {
// contains filtered or unexported fields
}
StoreManager manages multiple LogStore instances with caching.
func NewStoreManager ¶
func NewStoreManager(basePath string) *StoreManager
NewStoreManager creates a new StoreManager.
func (*StoreManager) BasePath ¶
func (m *StoreManager) BasePath() string
BasePath returns the base path for log storage.
func (*StoreManager) CloseAll ¶
func (m *StoreManager) CloseAll() error
CloseAll closes all cached stores.
func (*StoreManager) GetStateStore ¶
func (m *StoreManager) GetStateStore(logDID string) (storage.StateStore, error)
GetStateStore returns the StateStore for the given log DID. This is a convenience method that returns storage.StateStore interface.
func (*StoreManager) GetStore ¶
func (m *StoreManager) GetStore(logDID string) (*LogStore, error)
GetStore returns the LogStore for the given log DID. If logDID ends with "-revocations", it returns the store for the main log. Stores are cached and reused.
func (*StoreManager) ListLogDIDs ¶
func (m *StoreManager) ListLogDIDs() ([]string, error)
ListLogDIDs returns the DIDs of all known logs by enumerating subdirectories.