backend

package
v0.0.0-...-a803489 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2025 License: MIT Imports: 30 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NotifKindReply   = "reply"
	NotifKindLike    = "like"
	NotifKindMention = "mention"
	NotifKindRepost  = "repost"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type MissingRecord

type MissingRecord struct {
	Type       MissingRecordType
	Identifier string // DID for profiles, AT-URI for posts/feedgens
	Wait       bool
	// contains filtered or unexported fields
}

type MissingRecordType

type MissingRecordType string
const (
	MissingRecordTypeProfile       MissingRecordType = "profile"
	MissingRecordTypePost          MissingRecordType = "post"
	MissingRecordTypeFeedGenerator MissingRecordType = "feedgenerator"
	MissingRecordTypeUnknown       MissingRecordType = "unknown"
)

type PostgresBackend

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

PostgresBackend handles database operations

func NewPostgresBackend

func NewPostgresBackend(mydid string, db *gorm.DB, pgx *pgxpool.Pool, client *xrpc.Client, dir identity.Directory) (*PostgresBackend, error)

NewPostgresBackend creates a new PostgresBackend

func (*PostgresBackend) AddNotification

func (b *PostgresBackend) AddNotification(ctx context.Context, forUser, author uint, recordUri string, recordCid cid.Cid, kind string) error

func (*PostgresBackend) AddRelevantDid

func (b *PostgresBackend) AddRelevantDid(did string)

func (*PostgresBackend) DidFromID

func (b *PostgresBackend) DidFromID(ctx context.Context, uid uint) (string, error)

func (*PostgresBackend) DidIsRelevant

func (b *PostgresBackend) DidIsRelevant(did string) bool

func (*PostgresBackend) DidToID

func (b *PostgresBackend) DidToID(ctx context.Context, did string) (uint, error)

DidToID converts a DID to a database ID

func (*PostgresBackend) GetOrCreateList

func (b *PostgresBackend) GetOrCreateList(ctx context.Context, uri string) (*List, error)

func (*PostgresBackend) GetOrCreateRepo

func (b *PostgresBackend) GetOrCreateRepo(ctx context.Context, did string) (*Repo, error)

func (*PostgresBackend) GetPostByUri

func (b *PostgresBackend) GetPostByUri(ctx context.Context, uri string, fields string) (*Post, error)

func (*PostgresBackend) GetRelevantDids

func (b *PostgresBackend) GetRelevantDids() []string

func (*PostgresBackend) GetRepoByID

func (b *PostgresBackend) GetRepoByID(ctx context.Context, id uint) (*models.Repo, error)

func (*PostgresBackend) HandleCreate

func (b *PostgresBackend) HandleCreate(ctx context.Context, repo string, rev string, path string, rec *[]byte, cid *cid.Cid) error

func (*PostgresBackend) HandleCreateBlock

func (b *PostgresBackend) HandleCreateBlock(ctx context.Context, repo *Repo, rkey string, recb []byte, cc cid.Cid) error

func (*PostgresBackend) HandleCreateChatDeclaration

func (b *PostgresBackend) HandleCreateChatDeclaration(ctx context.Context, repo *Repo, rkey string, recb []byte, cc cid.Cid) error

func (*PostgresBackend) HandleCreateFeedGenerator

func (b *PostgresBackend) HandleCreateFeedGenerator(ctx context.Context, repo *Repo, rkey string, recb []byte, cc cid.Cid) error

func (*PostgresBackend) HandleCreateFollow

func (b *PostgresBackend) HandleCreateFollow(ctx context.Context, repo *Repo, rkey string, recb []byte, cc cid.Cid) error

func (*PostgresBackend) HandleCreateLike

func (b *PostgresBackend) HandleCreateLike(ctx context.Context, repo *Repo, rkey string, recb []byte, cc cid.Cid) error

func (*PostgresBackend) HandleCreateList

func (b *PostgresBackend) HandleCreateList(ctx context.Context, repo *Repo, rkey string, recb []byte, cc cid.Cid) error

func (*PostgresBackend) HandleCreateListblock

func (b *PostgresBackend) HandleCreateListblock(ctx context.Context, repo *Repo, rkey string, recb []byte, cc cid.Cid) error

func (*PostgresBackend) HandleCreateListitem

func (b *PostgresBackend) HandleCreateListitem(ctx context.Context, repo *Repo, rkey string, recb []byte, cc cid.Cid) error

func (*PostgresBackend) HandleCreatePost

func (b *PostgresBackend) HandleCreatePost(ctx context.Context, repo *Repo, rkey string, recb []byte, cc cid.Cid) error

func (*PostgresBackend) HandleCreatePostGate

func (b *PostgresBackend) HandleCreatePostGate(ctx context.Context, repo *Repo, rkey string, recb []byte, cc cid.Cid) error

func (*PostgresBackend) HandleCreateProfile

func (b *PostgresBackend) HandleCreateProfile(ctx context.Context, repo *Repo, rkey, rev string, recb []byte, cc cid.Cid) error

func (*PostgresBackend) HandleCreateRepost

func (b *PostgresBackend) HandleCreateRepost(ctx context.Context, repo *Repo, rkey string, recb []byte, cc cid.Cid) error

func (*PostgresBackend) HandleCreateStarterPack

func (b *PostgresBackend) HandleCreateStarterPack(ctx context.Context, repo *Repo, rkey string, recb []byte, cc cid.Cid) error

func (*PostgresBackend) HandleCreateThreadgate

func (b *PostgresBackend) HandleCreateThreadgate(ctx context.Context, repo *Repo, rkey string, recb []byte, cc cid.Cid) error

func (*PostgresBackend) HandleDelete

func (b *PostgresBackend) HandleDelete(ctx context.Context, repo string, rev string, path string) error

func (*PostgresBackend) HandleDeleteBlock

func (b *PostgresBackend) HandleDeleteBlock(ctx context.Context, repo *Repo, rkey string) error

func (*PostgresBackend) HandleDeleteFeedGenerator

func (b *PostgresBackend) HandleDeleteFeedGenerator(ctx context.Context, repo *Repo, rkey string) error

func (*PostgresBackend) HandleDeleteFollow

func (b *PostgresBackend) HandleDeleteFollow(ctx context.Context, repo *Repo, rkey string) error

func (*PostgresBackend) HandleDeleteLike

func (b *PostgresBackend) HandleDeleteLike(ctx context.Context, repo *Repo, rkey string) error

func (*PostgresBackend) HandleDeleteList

func (b *PostgresBackend) HandleDeleteList(ctx context.Context, repo *Repo, rkey string) error

func (*PostgresBackend) HandleDeleteListblock

func (b *PostgresBackend) HandleDeleteListblock(ctx context.Context, repo *Repo, rkey string) error

func (*PostgresBackend) HandleDeleteListitem

func (b *PostgresBackend) HandleDeleteListitem(ctx context.Context, repo *Repo, rkey string) error

func (*PostgresBackend) HandleDeletePost

func (b *PostgresBackend) HandleDeletePost(ctx context.Context, repo *Repo, rkey string) error

func (*PostgresBackend) HandleDeleteProfile

func (b *PostgresBackend) HandleDeleteProfile(ctx context.Context, repo *Repo, rkey string) error

func (*PostgresBackend) HandleDeleteRepost

func (b *PostgresBackend) HandleDeleteRepost(ctx context.Context, repo *Repo, rkey string) error

func (*PostgresBackend) HandleDeleteThreadgate

func (b *PostgresBackend) HandleDeleteThreadgate(ctx context.Context, repo *Repo, rkey string) error

func (*PostgresBackend) HandleEvent

func (*PostgresBackend) HandleEventJetstream

func (b *PostgresBackend) HandleEventJetstream(ctx context.Context, evt *jsmodels.Event) error

func (*PostgresBackend) HandleUpdate

func (b *PostgresBackend) HandleUpdate(ctx context.Context, repo string, rev string, path string, rec *[]byte, cid *cid.Cid) error

func (*PostgresBackend) HandleUpdateProfile

func (b *PostgresBackend) HandleUpdateProfile(ctx context.Context, repo *Repo, rkey, rev string, recb []byte, cc cid.Cid) error

func (*PostgresBackend) LoadRelevantDids

func (b *PostgresBackend) LoadRelevantDids() error

func (*PostgresBackend) TrackMissingRecord

func (b *PostgresBackend) TrackMissingRecord(identifier string, wait bool)

TrackMissingRecord implements the RecordTracker interface

type RecordTracker

type RecordTracker interface {
	// TrackMissingRecord queues a missing record for fetching
	// identifier can be:
	//  - A DID (e.g., "did:plc:...") for actors/profiles
	//  - An AT-URI (e.g., "at://did:plc:.../app.bsky.feed.post/...") for posts
	//  - An AT-URI (e.g., "at://did:plc:.../app.bsky.feed.generator/...") for feed generators
	// wait: if true, blocks until the record is fetched
	TrackMissingRecord(identifier string, wait bool)
}

RecordTracker is an interface for tracking missing records that need to be fetched

type SyncInfo

type SyncInfo struct {
	Repo          uint `gorm:"index"`
	FollowsSynced bool
	Rev           string
}

Jump to

Keyboard shortcuts

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