logstream

package
v0.6.0-beta.3 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const NodeNamePrefix = "marmot-node"
View Source
const SnapshotShardID = uint64(1)

Variables

This section is empty.

Functions

This section is empty.

Types

type ReplicationEvent

type ReplicationEvent[T any] struct {
	FromNodeId uint64
	Payload    *T
}

func (*ReplicationEvent[T]) Marshal

func (e *ReplicationEvent[T]) Marshal() ([]byte, error)

func (*ReplicationEvent[T]) Unmarshal

func (e *ReplicationEvent[T]) Unmarshal(data []byte) error

type Replicator

type Replicator struct {
	// contains filtered or unexported fields
}

func NewReplicator

func NewReplicator(
	nodeID uint64,
	natsServer string,
	shards uint64,
	compress bool,
	snapshot snapshot.NatsSnapshot,
) (*Replicator, error)

func (*Replicator) Listen

func (r *Replicator) Listen(shardID uint64, callback func(payload []byte) error) error

func (*Replicator) Publish

func (r *Replicator) Publish(hash uint64, payload []byte) error

func (*Replicator) RestoreSnapshot added in v0.6.0

func (r *Replicator) RestoreSnapshot() error

func (*Replicator) SaveSnapshot added in v0.6.0

func (r *Replicator) SaveSnapshot()

Jump to

Keyboard shortcuts

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