Documentation ¶
Overview ¶
Package heavyclient contains heavy replication client code.
Index ¶
- type JetClient
- type Options
- type Pool
- func (scp *Pool) AddPulsesToSyncClient(ctx context.Context, jetID core.RecordID, shouldrun bool, ...) *JetClient
- func (scp *Pool) AllClients(ctx context.Context) []*JetClient
- func (scp *Pool) LightCleanup(ctx context.Context, untilPN core.PulseNumber, rsp recentstorage.Provider, ...) error
- func (scp *Pool) Stop(ctx context.Context)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type JetClient ¶
type JetClient struct {
// contains filtered or unexported fields
}
JetClient heavy replication client. Replicates records for one jet.
func NewJetClient ¶
func NewJetClient( replicaStorage storage.ReplicaStorage, mb core.MessageBus, pulseStorage core.PulseStorage, pulseTracker storage.PulseTracker, cleaner storage.Cleaner, db storage.DBContext, jetID core.RecordID, opts Options, ) *JetClient
NewJetClient heavy replication client constructor.
First argument defines what jet it serve.
type Options ¶
type Options struct { SyncMessageLimit int PulsesDeltaLimit int BackoffConf configuration.Backoff }
Options contains heavy client configuration params.
type Pool ¶
Pool manages state of heavy sync clients (one client per jet id).
func NewPool ¶
func NewPool( bus core.MessageBus, pulseStorage core.PulseStorage, tracker storage.PulseTracker, replicaStorage storage.ReplicaStorage, cleaner storage.Cleaner, db storage.DBContext, clientDefaults Options, ) *Pool
NewPool constructor of new pool.
func (*Pool) AddPulsesToSyncClient ¶
func (scp *Pool) AddPulsesToSyncClient( ctx context.Context, jetID core.RecordID, shouldrun bool, pns ...core.PulseNumber, ) *JetClient
AddPulsesToSyncClient add pulse numbers to the end of jet's heavy client queue.
Bool flag 'shouldrun' controls should heavy client be started (if not already) or not.
func (*Pool) AllClients ¶ added in v0.8.0
AllClients returns slice with all clients in Pool.
func (*Pool) LightCleanup ¶ added in v0.8.0
func (scp *Pool) LightCleanup( ctx context.Context, untilPN core.PulseNumber, rsp recentstorage.Provider, jetIndexesRemoved map[core.RecordID][]core.RecordID, ) error
LightCleanup starts async cleanup on all heavy synchronization clients (per jet cleanup).
Waits until all cleanup will done and mesaures time.
Under hood it uses singleflight on Jet prefix to avoid clashing on the same key space.