crdt

package
v0.6.0-dev Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2025 License: AGPL-3.0, AGPL-3.0-or-later Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Broadcaster

type Broadcaster interface {
	Broadcast(ctx context.Context, data []byte) error
	Next(ctx context.Context) ([]byte, error)
}

Broadcaster interface for CRDT synchronization

type CRDTRouter

type CRDTRouter interface {
	FindProvidersAsync(context.Context, cid.Cid, int) <-chan peer.AddrInfo
}

type CRDTStatsStore

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

CRDTStatsStore manages CRDT-based tweet statistics

func NewCRDTStatsStore

func NewCRDTStatsStore(
	ctx context.Context,
	broadcaster Broadcaster,
	datastore CRDTStorer,
	node host.Host,
	router CRDTRouter,
) (*CRDTStatsStore, error)

NewCRDTStatsStore creates a new CRDT-based statistics store

func (*CRDTStatsStore) Close

func (s *CRDTStatsStore) Close() error

Close stops the CRDT store

func (*CRDTStatsStore) GetAggregatedStat

func (s *CRDTStatsStore) GetAggregatedStat(key ds.Key) (uint64, error)

GetAggregatedStat gets the aggregated count for a specific statistic across all nodes

func (*CRDTStatsStore) Put

func (s *CRDTStatsStore) Put(key ds.Key, value uint64) error

Put stores a counter value

type CRDTStorer

type CRDTStorer interface {
	ds.Datastore
	Prefix() string
}

type GossipBroadcaster

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

GossipBroadcaster adapts Gossip to CRDT Broadcaster interface

func NewGossipBroadcaster

func NewGossipBroadcaster(ctx context.Context, gossip GossipPubSuber) (*GossipBroadcaster, error)

NewGossipBroadcaster creates a new Gossip-based broadcaster for CRDT

func (*GossipBroadcaster) Broadcast

func (gb *GossipBroadcaster) Broadcast(_ context.Context, data []byte) error

Broadcast sends data via Gossip

func (*GossipBroadcaster) Next

func (gb *GossipBroadcaster) Next(ctx context.Context) ([]byte, error)

Next receives broadcasted data

func (*GossipBroadcaster) Receive

func (gb *GossipBroadcaster) Receive(data []byte)

Receive is called by Gossip subscription handler to deliver data

type GossipPubSuber

type GossipPubSuber interface {
	PublishRaw(topicName string, data []byte) error
	SubscribeRaw(topicName string, h func([]byte) error) error
}

GossipPublisher interface for publishing to Gossip

Jump to

Keyboard shortcuts

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