sharddb

package
v0.0.0-...-524d49d Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var QueryDuration = promauto.NewHistogramVec(prometheus.HistogramOpts{
	Name: "sharddb_query_duration_seconds",
	Help: "Duration of sharddb queries",
}, []string{"query_name", "status"})

Functions

func GetBucketFromRKey

func GetBucketFromRKey(rkey string) (int, error)

func GetHighestRKeyForBucket

func GetHighestRKeyForBucket(bucket int) string

func GetLowestRKeyForBucket

func GetLowestRKeyForBucket(bucket int) string

Types

type Post

type Post struct {
	ActorDID  string
	Rkey      string
	IndexedAt time.Time
	Bucket    int
	Raw       []byte
	Langs     []string
	Tags      []string
	HasMedia  bool
	IsReply   bool
}

type ShardDB

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

func NewShardDB

func NewShardDB(ctx context.Context, scyllaNodes []string, logger *slog.Logger) (*ShardDB, error)

func (*ShardDB) CreatePostTable

func (s *ShardDB) CreatePostTable(ctx context.Context) error

func (*ShardDB) DeletePost

func (s *ShardDB) DeletePost(ctx context.Context, actorDID, rkey string, indexedAt time.Time, bucket int) error

func (*ShardDB) GetPostMetas

func (s *ShardDB) GetPostMetas(ctx context.Context, bucket, limit int, cursor time.Time) ([]*Post, time.Time, error)

GetPostMetas returns a page of posts without the raw content

func (*ShardDB) GetPosts

func (s *ShardDB) GetPosts(ctx context.Context, bucket, limit int, cursor time.Time) ([]*Post, time.Time, error)

func (*ShardDB) InsertPost

func (s *ShardDB) InsertPost(ctx context.Context, post Post) error

Jump to

Keyboard shortcuts

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