Documentation
¶
Overview ¶
Package sync provides thread synchronization utilities for ActivityPub conversation management.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrFetchThreadContext is returned when thread context cannot be fetched ErrFetchThreadContext = errors.ProcessingFailed("thread context fetch", stdErrors.New("thread context fetch failed")) // ErrFetchRootNote is returned when root note cannot be fetched ErrFetchRootNote = errors.FailedToGet("root note", stdErrors.New("failed to get root note")) // ErrInvalidRootObject is returned when root object is not a Note ErrInvalidRootObject = errors.NewValidationError("root_object", "is not a Note") // ErrGetNote is returned when note cannot be retrieved from storage ErrGetNote = errors.FailedToGet("note", stdErrors.New("failed to get note")) // ErrInvalidNoteType is returned when object is not a Note type ErrInvalidNoteType = errors.NewValidationError("object_type", "is not a Note") // ErrFetchParent is returned when parent note cannot be fetched ErrFetchParent = errors.FailedToGet("parent note", stdErrors.New("failed to get parent note")) // ErrStoreParentNote is returned when parent note cannot be stored ErrStoreParentNote = errors.FailedToStore("parent note", stdErrors.New("failed to store parent note")) )
Thread synchronization errors
Functions ¶
This section is empty.
Types ¶
type FederationClient ¶
type FederationClient interface {
FetchObject(ctx context.Context, url string) (any, error)
FetchReplies(ctx context.Context, noteURL string) ([]*activitypub.Note, error)
FetchContext(ctx context.Context, noteURL string) (*ThreadContext, error)
}
FederationClient interface for making federation requests
type Thread ¶
type Thread struct {
ConversationID string
RootNote *activitypub.Note
Replies []*activitypub.Note
Participants []string
LastUpdated time.Time
TotalPosts int
MissingPosts []string // URLs of posts we know exist but couldn't fetch
}
Thread represents a complete conversation thread
type ThreadCache ¶
type ThreadCache interface {
GetThread(ctx context.Context, conversationID string) (*Thread, error)
SetThread(ctx context.Context, conversationID string, thread *Thread, ttl time.Duration) error
}
ThreadCache interface for caching thread data
type ThreadContext ¶
type ThreadContext struct {
ConversationID string `json:"conversationId"`
RootURL string `json:"rootUrl"`
ReplyCount int `json:"replyCount"`
Participants []string `json:"participants"`
LastActivity time.Time `json:"lastActivity"`
}
ThreadContext provides metadata about a thread from the origin server
type ThreadSyncRequest ¶
type ThreadSyncRequest struct {
ConversationID string
OriginServer string
Depth int
IncludeBoosts bool
IncludeReplies bool
ForceRefresh bool
}
ThreadSyncRequest represents a request to sync a thread
type ThreadSyncer ¶
type ThreadSyncer struct {
// contains filtered or unexported fields
}
ThreadSyncer handles synchronization of conversation threads across instances
func NewThreadSyncer ¶
func NewThreadSyncer(storage core.RepositoryStorage, federation FederationClient, cache ThreadCache) *ThreadSyncer
NewThreadSyncer creates a new thread synchronization service
func (*ThreadSyncer) SyncMissingContext ¶
func (t *ThreadSyncer) SyncMissingContext(ctx context.Context, noteID string) error
SyncMissingContext fetches missing context for existing notes
func (*ThreadSyncer) SyncThread ¶
func (t *ThreadSyncer) SyncThread(ctx context.Context, req ThreadSyncRequest) error
SyncThread synchronizes a complete thread from its origin server