Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DownloadMetric ¶ added in v0.0.6
type MonitorConfig ¶ added in v0.0.4
type MonitorOps ¶ added in v0.0.4
type MonitorOps func(config *WALMonitor)
MonitorOps configuration functions that customize the monitor
type Reflector ¶
type Reflector struct {
// contains filtered or unexported fields
}
Reflector represents a fully materialized reflector, which polls an upstream database's ledger table for DML statements and applies them to a local SQLite database (LDB).
func ReflectorFromConfig ¶
func ReflectorFromConfig(config ReflectorConfig) (*Reflector, error)
ReflectorFromConfig instantiates a Reflector instance using the configuration specified by a ReflectorConfig instance
type ReflectorConfig ¶
type ReflectorConfig struct {
LDBPath string
ChangelogPath string
ChangelogSize int
Upstream UpstreamConfig
BootstrapURL string
LedgerHealth ledger.HealthConfig
IsSupervisor bool
LDBWriteCallback ldbwriter.LDBWriteCallback // optional
BootstrapRegion string // optional
// How often to poll the WAL stats
WALPollInterval time.Duration // optional
// Performs a checkpoint after the WAL file exceeds this size in bytes
WALCheckpointThresholdSize int // optional
// What type of checkpoint to perform
WALCheckpointType ldbwriter.CheckpointType // optional
DoMonitorWAL bool // optional
BusyTimeoutMS int // optional
ID string
Logger *events.Logger
}
ReflectorConfig is used to configure a Reflector instance that is instantiated by ReflectorFromConfig
func (ReflectorConfig) Printable ¶
func (c ReflectorConfig) Printable() string
Printable returns a "pretty" stringified version of the config
type ReflectorCtl ¶
type ReflectorCtl struct {
// contains filtered or unexported fields
}
reflectorCtl controls starting and stopping the reflector for the purposes of a supervisor being able to perform a snapshot of the ldb without the reflector running concurrently. When the snapshot must be made, it will stop the reflector, perform the snapshot, and then start the reflector again.
func NewReflectorCtl ¶
func NewReflectorCtl(reflector ReflectorI) *ReflectorCtl
func (*ReflectorCtl) Close ¶
func (r *ReflectorCtl) Close() error
func (*ReflectorCtl) Start ¶
func (r *ReflectorCtl) Start(ctx context.Context)
Start sends a start msg to the lifecycle goroutine. The lifecycle goroutine manages the state machine of the reflector. Since the lifecycle is a single goroutine it is last-write-wins.
func (*ReflectorCtl) Stop ¶
func (r *ReflectorCtl) Stop(ctx context.Context)
Stop sends a start msg to the lifecycle goroutine. The lifecycle goroutine manages the state machine of the reflector. Since the lifecycle is a single goroutine it is last-write-wins.
type S3Downloader ¶
type S3Downloader struct {
Region string // optional
Bucket string
Key string
S3Client S3Client
StartOverOnNotFound bool // whether we should rebuild LDB if snapshot not found
}
func (*S3Downloader) DownloadTo ¶
func (d *S3Downloader) DownloadTo(w io.Writer) (n int64, err error)
type UpstreamConfig ¶
type UpstreamConfig struct {
Driver string
DSN string
LedgerTable string
QueryBlockSize int
PollInterval time.Duration
PollTimeout time.Duration
PollJitterCoefficient float64
}
UpstreamConfig specifies how to reach and treat the upstream CtlDB.
type WALMonitor ¶ added in v0.0.4
type WALMonitor struct {
// contains filtered or unexported fields
}
WALMonitor is responsible for querying the file size of sqlite's WAL file while in WAL mode as well as sqlite's checkpointing of the WAL file.
func NewMonitor ¶ added in v0.0.4
func NewMonitor(cfg MonitorConfig, checkpointTester checkpointTesterFunc, opts ...MonitorOps) *WALMonitor
func (*WALMonitor) Start ¶ added in v0.0.4
func (m *WALMonitor) Start(ctx context.Context)
Start runs the wal file size check and sqlite checkpoint check on PollInterval's cadence this method blocks