Documentation ¶
Index ¶
Constants ¶
const DEFAULT_SYNC_INTERVAL = 10
DEFAULT_SYNC_INTERVAL is the number of seconds between RPC calls to retrieve new blocks
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Replicator ¶
type Replicator struct { GrpcClient ccmsg.LedgerClient // contains filtered or unexported fields }
Replicator replicates the ledger from the central server to a local data store, calling back to subscribers on every block.
func NewReplicator ¶
func NewReplicator(l *logrus.Logger, storage *ledger.Database, addr string, insecure bool) (*Replicator, error)
NewReplicator creates a new replicator replicating into `persistence` from `addr`.
func (*Replicator) FetchBlocks ¶
func (r *Replicator) FetchBlocks(ctx context.Context) error
FetchBlocks queries new blocks from the ledger
func (*Replicator) IsSynced ¶
func (r *Replicator) IsSynced(ctx context.Context) (bool, error)
IsSynced queries the ledger for the highest blocked and compares that to the local DB to report whether the chain is up to date or not. 'synced' is poorly defined for a distributed system, but here it means that this local database has replicated all the information that the ledger it is connected to has to give it.