db

package
v0.6.2 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2025 License: MIT Imports: 15 Imported by: 4

Documentation

Index

Constants

View Source
const CName = "consensus.db"
View Source
const (
	// Version2 - payloads moved to the separate collection
	Version2 = 2
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ChangeReceiver

type ChangeReceiver func(logId string, records []consensus.Record)

type Config added in v0.4.2

type Config struct {
	Connect       string `yaml:"connect"`
	Database      string `yaml:"database"`
	LogCollection string `yaml:"logCollection"`
}

type Service

type Service interface {
	// AddLog adds new log db
	AddLog(ctx context.Context, log consensus.Log) (err error)
	// DeleteLog deletes the log
	DeleteLog(ctx context.Context, logId string) error
	// AddRecord adds new record to existing log
	// returns consensuserr.ErrConflict if record didn't match or log not found
	AddRecord(ctx context.Context, logId string, record consensus.Record) (err error)
	// FetchLog gets log by id
	FetchLog(ctx context.Context, logId, afterRecordId string) (log consensus.Log, err error)
	// SetChangeReceiver sets the receiver for updates, it must be called before app.Run stage
	SetChangeReceiver(receiver ChangeReceiver) (err error)
	// SetDeletionId sets the last deleted log id
	SetDeletionId(ctx context.Context, lastId string) (err error)
	// GetDeletionId gets the last deletion log id
	GetDeletionId(ctx context.Context) (lastId string, err error)
	app.ComponentRunnable
}

func New

func New() Service

Directories

Path Synopsis
Package mock_db is a generated GoMock package.
Package mock_db is a generated GoMock package.

Jump to

Keyboard shortcuts

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