Documentation
¶
Overview ¶
Package types contains shared types used across the synckit ecosystem. This package exists to prevent import cycles between synckit and its subpackages.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Conflict ¶ added in v0.18.0
type Conflict struct {
EventType string
AggregateID string
ChangedFields []string
Metadata map[string]interface{}
Local EventWithVersion
Remote EventWithVersion
}
Conflict carries the context needed to resolve a detected conflict between local and remote changes. Domain-agnostic by design.
type ConflictResolver ¶ added in v0.18.0
type ConflictResolver interface {
Resolve(ctx context.Context, c Conflict) (ResolvedConflict, error)
}
ConflictResolver is the Strategy interface for conflict resolution.
type Event ¶
type Event interface {
// ID returns a unique identifier for this event
ID() string
// Type returns the event type (e.g., "UserCreated", "OrderUpdated")
Type() string
// AggregateID returns the ID of the aggregate this event belongs to
AggregateID() string
// Data returns the event payload
Data() interface{}
// Metadata returns additional event metadata
Metadata() map[string]interface{}
}
Event represents a syncable event in the system.
type EventWithVersion ¶
EventWithVersion pairs an event with its version information.
type ResolvedConflict ¶ added in v0.18.0
type ResolvedConflict struct {
ResolvedEvents []EventWithVersion
Decision string
Reasons []string
}
ResolvedConflict captures the decision and any follow-up data.
type Version ¶
type Version interface {
// Compare returns -1 if this version is before other, 0 if equal, 1 if after
Compare(other Version) int
// String returns a string representation of the version
String() string
// IsZero returns true if this is the zero/initial version
IsZero() bool
}
Version represents a point-in-time snapshot for sync operations. Users can implement different versioning strategies (timestamps, hashes, vector clocks).