postgresstore

package
v0.0.0-...-a4d05e0 Latest Latest
Warning

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

Go to latest
Published: May 11, 2023 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrTODO          = errors.New("TODO")
	ErrTopicMismatch = errors.New("topic mismatch")
	ErrMissingTopic  = errors.New("missing topic")
	ErrTooManyTopics = errors.New("too many topics")
)

Functions

This section is empty.

Types

type DB

type DB struct {
	*sql.DB
	DSN string
}

func NewDB

func NewDB(opts *Options) (*DB, error)

type NodeStore

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

func NewNodeStore

func NewNodeStore(ctx context.Context, db *DB) (*NodeStore, error)

func (*NodeStore) Close

func (s *NodeStore) Close() error

func (*NodeStore) DeleteTopic

func (s *NodeStore) DeleteTopic(topic string) error

func (*NodeStore) NewTopic

func (s *NodeStore) NewTopic(topic string) (crdt.Store, error)

func (*NodeStore) Topics

func (s *NodeStore) Topics() (topics []string, err error)

type Options

type Options struct {
	DSN string `long:"dsn" env:"POSTGRES_DSN" description:"Postgres connection string" default:""`
}

type Store

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

func New

func New(ctx context.Context, db *DB, topic string) *Store

func (*Store) AppendEvent

func (s *Store) AppendEvent(ctx context.Context, env *messagev1.Envelope) (*types.Event, error)

func (*Store) Events

func (s *Store) Events(ctx context.Context) ([]*types.Event, error)
func (s *Store) FindMissingLinks(ctx context.Context) ([]multihash.Multihash, error)

func (*Store) GetEvents

func (s *Store) GetEvents(ctx context.Context, cids ...multihash.Multihash) ([]*types.Event, error)

func (*Store) Heads

func (s *Store) Heads(ctx context.Context) ([]multihash.Multihash, error)

func (*Store) InsertEvent

func (s *Store) InsertEvent(ctx context.Context, ev *types.Event) (bool, error)

func (*Store) InsertHead

func (s *Store) InsertHead(ctx context.Context, ev *types.Event) (bool, error)

func (*Store) InsertNewEvents

func (s *Store) InsertNewEvents(ctx context.Context, evs []*types.Event) error

func (*Store) Query

func (*Store) RemoveHead

func (s *Store) RemoveHead(ctx context.Context, cid multihash.Multihash) (bool, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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