Documentation ¶
Index ¶
- func PostFromCommitEvent(evt CommitEvent) (*post.Post, error)
- func SubscribeToFirehose(ctx context.Context, auth AuthProvider, callbacks *FirehoseCallbacks) errordeprecated
- type AuthProvider
- type CommitEvent
- type EnhancedFirehose
- type EnhancedFirehoseCallbacks
- type Firehose
- type FirehoseCallbacks
- type FirehoseHandler
- type HandleEvent
- type HandleFilter
- type HandleHandlerWithFilter
- type InfoEvent
- type InfoFilter
- type InfoHandlerWithFilter
- type MigrateEvent
- type MigrateFilter
- type MigrateHandlerWithFilter
- type OnHandleHandler
- type OnInfoHandler
- type OnMigrateHandler
- type OnPostHandler
- type OnTombstoneHandler
- type PostFilter
- type PostHandlerWithFilter
- type RawOperationHandler
- type RepoOperation
- type TombstoneEvent
- type TombstoneFilter
- type TombstoneHandlerWithFilter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func PostFromCommitEvent ¶
func PostFromCommitEvent(evt CommitEvent) (*post.Post, error)
PostFromCommitEvent converts a CommitEvent to a Post
func SubscribeToFirehose
deprecated
func SubscribeToFirehose(ctx context.Context, auth AuthProvider, callbacks *FirehoseCallbacks) error
Deprecated: Use Firehose.Subscribe instead
Types ¶
type AuthProvider ¶
type AuthProvider interface { GetAccessToken() string GetFirehoseURL() string GetTimeout() time.Duration }
AuthProvider defines the minimal interface needed for firehose authentication
type CommitEvent ¶
type CommitEvent struct { Repo string // repository DID Time string // timestamp Ops []RepoOperation // operations performed }
CommitEvent represents a commit to a repository
type EnhancedFirehose ¶
type EnhancedFirehose struct {
*Firehose
}
EnhancedFirehose extends the base Firehose with additional functionality
func NewEnhancedFirehose ¶
func NewEnhancedFirehose(auth AuthProvider) *EnhancedFirehose
NewEnhancedFirehose creates a new EnhancedFirehose instance
func (*EnhancedFirehose) Subscribe ¶
func (f *EnhancedFirehose) Subscribe(ctx context.Context, callbacks *EnhancedFirehoseCallbacks) error
Subscribe subscribes to the Bluesky firehose with enhanced functionality
type EnhancedFirehoseCallbacks ¶
type EnhancedFirehoseCallbacks struct { *FirehoseCallbacks Handlers []RawOperationHandler PostHandlers []PostHandlerWithFilter HandleHandlers []HandleHandlerWithFilter InfoHandlers []InfoHandlerWithFilter MigrateHandlers []MigrateHandlerWithFilter TombstoneHandlers []TombstoneHandlerWithFilter FollowHandlers []interaction.FollowHandlerWithFilter LikeHandlers []interaction.LikeHandlerWithFilter RepostHandlers []interaction.RepostHandlerWithFilter CommentHandlers []interaction.CommentHandlerWithFilter }
EnhancedFirehoseCallbacks contains all the callback handlers
type Firehose ¶
type Firehose struct {
// contains filtered or unexported fields
}
Firehose manages the connection to the Bluesky firehose
func NewFirehose ¶
func NewFirehose(auth AuthProvider) *Firehose
NewFirehose creates a new Firehose instance
type FirehoseCallbacks ¶
type FirehoseCallbacks struct { // OnCommit is called when a repository commit occurs OnCommit func(evt *CommitEvent) error // OnHandle is called when a handle change occurs OnHandle func(evt *HandleEvent) error // OnInfo is called when repository information is received OnInfo func(evt *InfoEvent) error // OnMigrate is called when a repository migration occurs OnMigrate func(evt *MigrateEvent) error // OnTombstone is called when a repository is tombstoned OnTombstone func(evt *TombstoneEvent) error }
FirehoseCallbacks defines callbacks for different firehose events
type FirehoseHandler ¶
type FirehoseHandler interface {
HandleRawOperation(op *RepoOperation) error
}
FirehoseHandler represents a generic handler for firehose events
type HandleEvent ¶
HandleEvent represents a handle change event
type HandleFilter ¶
type HandleFilter func(*HandleEvent) bool
HandleFilter is a function that filters handle events
type HandleHandlerWithFilter ¶
type HandleHandlerWithFilter struct { Handler func(*HandleEvent) error Filters []HandleFilter }
HandleHandlerWithFilter combines a handle handler with its filters
type InfoEvent ¶
type InfoEvent struct { Name string // name of the event Message string // info message, may be empty }
InfoEvent represents repository information
type InfoFilter ¶
InfoFilter is a function that filters info events
type InfoHandlerWithFilter ¶
type InfoHandlerWithFilter struct { Handler func(*InfoEvent) error Filters []InfoFilter }
InfoHandlerWithFilter combines an info handler with its filters
type MigrateEvent ¶
type MigrateEvent struct { Did string // DID being migrated MigrateTo string // destination, may be empty }
MigrateEvent represents a repository migration
type MigrateFilter ¶
type MigrateFilter func(evt *MigrateEvent) bool
MigrateFilter is a function that filters Migrate events
type MigrateHandlerWithFilter ¶
type MigrateHandlerWithFilter struct { Handler func(*MigrateEvent) error Filters []MigrateFilter }
MigrateHandlerWithFilter combines a migrate handler with its filters
type OnHandleHandler ¶
type OnHandleHandler struct { Filters []HandleFilter Handler func(evt *HandleEvent) error }
OnHandleHandler handles handle events with optional filters
type OnInfoHandler ¶
type OnInfoHandler struct { Filters []InfoFilter Handler func(evt *InfoEvent) error }
OnInfoHandler handles info events with optional filters
type OnMigrateHandler ¶
type OnMigrateHandler struct { Filters []MigrateFilter Handler func(evt *MigrateEvent) error }
OnMigrateHandler handles migrate events with optional filters
type OnPostHandler ¶
type OnPostHandler struct { Filters []PostFilter Handler func(post *post.Post) error }
OnPostHandler handles post events with optional filters
type OnTombstoneHandler ¶
type OnTombstoneHandler struct { Filters []TombstoneFilter Handler func(evt *TombstoneEvent) error }
OnTombstoneHandler handles tombstone events with optional filters
type PostHandlerWithFilter ¶
type PostHandlerWithFilter struct { Handler func(*post.Post) error Filters []PostFilter }
PostHandlerWithFilter combines a post handler with its filters
type RawOperationHandler ¶
type RawOperationHandler interface {
HandleRawOperation(op *RepoOperation) error
}
RawOperationHandler handles raw operations
type RepoOperation ¶
type RepoOperation struct { Action string // create, update, delete Path string // record path Cid string // content identifier Blocks []byte // CAR format blocks }
RepoOperation represents an operation on a repository
func (*RepoOperation) DecodeRecord ¶
func (op *RepoOperation) DecodeRecord(target any) error
DecodeRecord attempts to decode the record from blocks using the CID
type TombstoneEvent ¶
type TombstoneEvent struct { Did string // DID being tombstoned Time string // when it was tombstoned }
TombstoneEvent represents a repository being tombstoned
type TombstoneFilter ¶
type TombstoneFilter func(evt *TombstoneEvent) bool
TombstoneFilter is a function that filters Tombstone events
type TombstoneHandlerWithFilter ¶
type TombstoneHandlerWithFilter struct { Handler func(*TombstoneEvent) error Filters []TombstoneFilter }
TombstoneHandlerWithFilter combines a tombstone handler with its filters