Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Handler ¶
Handler processes an incoming sync message. Return error to log warning (message is NOT retried).
type IPublisher ¶
IPublisher publishes sync messages to subscribers.
type ISubscriber ¶
type ISubscriber interface {
// Subscribe registers a handler for a topic.
// Returns unsubscribe function.
Subscribe(topic string, handler Handler) (unsub func(), err error)
}
ISubscriber subscribes to sync topics.
type ISyncBus ¶
type ISyncBus interface {
IPublisher
ISubscriber
}
ISyncBus combines publish and subscribe capabilities.
type PatchSyncer ¶
type PatchSyncer[T any] struct { // contains filtered or unexported fields }
func NewPatchSyncer ¶
func NewPatchSyncer[T any](bus ISyncBus, cfg PatchSyncerConfig[T]) *PatchSyncer[T]
func (*PatchSyncer[T]) Publish ¶
func (s *PatchSyncer[T]) Publish(ctx context.Context, patch T) error
func (*PatchSyncer[T]) Start ¶
func (s *PatchSyncer[T]) Start() error
func (*PatchSyncer[T]) Stop ¶
func (s *PatchSyncer[T]) Stop()
type PatchSyncerConfig ¶
type PatchSyncerConfig[T any] struct { Topic string LocalSid int32 KeyOf func(T) int64 WithKey func(T, int64) T HasData func(T) bool Apply func(context.Context, T) error }
PatchSyncerConfig describes transient patch replication over ISyncBus. It intentionally has no store/delete/stale semantics; long-lived state belongs in cache replica or entity snapshot layers.
type SyncMsg ¶
type SyncMsg struct {
Topic string // sync topic (e.g. "remote_entity", "config")
Key int64 // business key (entity ID, config ID, etc.)
Version int64 // data version, subscriber uses to discard stale messages
Data []byte // serialized business data (nil means delete)
FromSid int32 // sender server ID
}
SyncMsg is the wire format for a sync message.
Click to show internal directories.
Click to hide internal directories.