events

package
v0.0.0-...-95b9c9f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 23, 2024 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

Types

type BSky

type BSky struct {
	IncludeLinks bool

	Logger *zap.SugaredLogger

	SeqMux      sync.RWMutex
	LastUpdated time.Time
	LastSeq     int64 // LastSeq is the last sequence number processed

	RepoRecordQueue chan RepoRecord

	WorkerCount int
	Workers     []*Worker

	PostRegistryEnabled bool
	PostRegistry        *search.PostRegistry

	PLCMirrorRoot string
	// contains filtered or unexported fields
}

BSky is a struct that holds the state of the social graph and the authenticated XRPC client

func NewBSky

func NewBSky(
	ctx context.Context,
	includeLinks, postRegistryEnabled bool,
	dbConnectionString, redisPrefix, plcMirrorRoot string,
	redisClient *redis.Client,
	workerCount int,
) (*BSky, error)

NewBSky creates a new BSky struct with an authenticated XRPC client and a social graph, initializing mutexes for cross-routine access

func (*BSky) DecodeFacets

func (bsky *BSky) DecodeFacets(
	ctx context.Context,
	facets []*appbsky.RichtextFacet,
) ([]string, []string, error)

DecodeFacets decodes the facets of a richtext record into mentions and links

func (*BSky) GetCursor

func (bsky *BSky) GetCursor(ctx context.Context) string

GetCursor returns the cursor for the graph.

func (*BSky) HandleError

func (bsky *BSky) HandleError(ctx context.Context, errf *events.ErrorFrame) error

func (*BSky) HandleRepoCommit

func (bsky *BSky) HandleRepoCommit(ctx context.Context, evt *comatproto.SyncSubscribeRepos_Commit) error

HandleRepoCommit is called when a repo commit is received and prints its contents

func (*BSky) ProcessRepoRecord

func (bsky *BSky) ProcessRepoRecord(
	ctx context.Context,
	seq int64,
	pst appbsky.FeedPost,
	opPath string,
	authorDID string,
	eventTime string,
	workerID int,
) error

func (*BSky) SetCursor

func (bsky *BSky) SetCursor(ctx context.Context, cursor int64) error

SetCursor sets the cursor for the graph.

type ImageMeta

type ImageMeta struct {
	CID      string `json:"cid"`
	MimeType string `json:"mime_type"`
	AltText  string `json:"alt_text"`
}

type RepoRecord

type RepoRecord struct {
	// contains filtered or unexported fields
}

RepoRecord holds data needed for processing a RepoRecord

type RepoStreamCtxCallbacks

type RepoStreamCtxCallbacks struct {
	RepoCommit    func(ctx context.Context, evt *comatproto.SyncSubscribeRepos_Commit) error
	RepoHandle    func(ctx context.Context, evt *comatproto.SyncSubscribeRepos_Handle) error
	RepoInfo      func(ctx context.Context, evt *comatproto.SyncSubscribeRepos_Info) error
	RepoMigrate   func(ctx context.Context, evt *comatproto.SyncSubscribeRepos_Migrate) error
	RepoTombstone func(ctx context.Context, evt *comatproto.SyncSubscribeRepos_Tombstone) error
	Error         func(ctx context.Context, evt *events.ErrorFrame) error
}

type Worker

type Worker struct {
	WorkerID int
	Logger   *zap.SugaredLogger
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL