Documentation
¶
Index ¶
- func MockRecordRule(c *engine.RecordContext, post *appbsky.FeedPost) error
- type DefaultHandler
- type Engine
- type FollowRuleFunc
- type Handler
- type LikeRuleFunc
- type MockDirectory
- func (d *MockDirectory) Insert(ident identity.Identity)
- func (d *MockDirectory) Lookup(ctx context.Context, a syntax.AtIdentifier) (*identity.Identity, error)
- func (d *MockDirectory) LookupDID(ctx context.Context, did syntax.DID) (*identity.Identity, error)
- func (d *MockDirectory) LookupHandle(ctx context.Context, h syntax.Handle) (*identity.Identity, error)
- func (d *MockDirectory) Purge(ctx context.Context, a syntax.AtIdentifier) error
- type RepostRuleFunc
- type RobustClient
- type RuleSet
- type Ticker
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MockRecordRule ¶
func MockRecordRule(c *engine.RecordContext, post *appbsky.FeedPost) error
Types ¶
type DefaultHandler ¶
type DefaultHandler struct {
Engine *Engine
}
DefaultHandler is a simple handler implementation that feeds events to the rules engine. It is intentionally kept simple to make it easy to replace with a more complex handler
func (*DefaultHandler) HandleEvent ¶
type Engine ¶
Engine is a class that takes in events from the jetstream and sends them to the automod Performs necessary conversions to interoperate with automod, which expects a different event format.
func NewBaseEngine ¶
NewBaseEngine is a convenience function that creates an Engine with simple default implementations. Intended to work out of the box with no additional external dependencies.
func (*Engine) ProcessAccountEvent ¶
Entry point for pushing account events to the automod
func (*Engine) ProcessIdentityEvent ¶
Entry point for pushing identity events to the automod
type FollowRuleFunc ¶
type FollowRuleFunc = func(c *bskyengine.RecordContext, follow *appbsky.GraphFollow) error
type LikeRuleFunc ¶
type LikeRuleFunc = func(c *bskyengine.RecordContext, follow *appbsky.FeedLike) error
type MockDirectory ¶
type MockDirectory struct {
Handles map[syntax.Handle]syntax.DID
Identities map[syntax.DID]identity.Identity
}
MockDirectory provides an automod-compatible directory that skips directory lookups. Significantly reduces requirements needed to connect to the jetstream. Assumes full validation of events is not necessary.
func NewMockDirectory ¶
func NewMockDirectory() MockDirectory
func (*MockDirectory) Insert ¶
func (d *MockDirectory) Insert(ident identity.Identity)
func (*MockDirectory) Lookup ¶
func (d *MockDirectory) Lookup(ctx context.Context, a syntax.AtIdentifier) (*identity.Identity, error)
func (*MockDirectory) LookupHandle ¶
func (*MockDirectory) Purge ¶
func (d *MockDirectory) Purge(ctx context.Context, a syntax.AtIdentifier) error
type RepostRuleFunc ¶
type RepostRuleFunc = func(c *bskyengine.RecordContext, follow *appbsky.FeedRepost) error
type RobustClient ¶
type RobustClient struct {
Client *client.Client
BackOff backoff.BackOff
RetryOn func(error) bool
// contains filtered or unexported fields
}
RobustClient is a jetstream client with automatic reconnect capability Wraps a basic client with a scheduler that tracks the event cursor for reconnects BackOff is not thread safe and should only be modified when client is inactivate
func NewRobustClient ¶
func NewRobustClient(config *client.ClientConfig, logger *slog.Logger, scheduler client.Scheduler) (*RobustClient, error)
func (*RobustClient) ConnectAndRead ¶
func (rc *RobustClient) ConnectAndRead(ctx context.Context, cursor *int64) error
type RuleSet ¶
type RuleSet struct {
FollowRules []FollowRuleFunc
RepostRules []RepostRuleFunc
LikeRules []LikeRuleFunc
// contains filtered or unexported fields
}
Ruleset defined as a wrapper as a workaround to the lack of an interface
func CreateRuleset ¶
func CreateRuleset(rules *bskyengine.RuleSet) *RuleSet
func (*RuleSet) CallRecordDeleteRules ¶
func (r *RuleSet) CallRecordDeleteRules(c *bskyengine.RecordContext) error
func (*RuleSet) CallRecordRules ¶
func (r *RuleSet) CallRecordRules(c *bskyengine.RecordContext) error