...

Package storage

import "vminko.org/dscuss/storage"
Overview
Index

Overview ▾

Index ▾

type Storage
    func New(db *sqlite.EntityDatabase) *Storage
    func (s *Storage) AttachObserver(c chan<- entity.Entity)
    func (s *Storage) Close() error
    func (s *Storage) DetachObserver(c chan<- entity.Entity)
    func (s *Storage) GetEntity(eid *entity.ID) (entity.Entity, error)
    func (s *Storage) GetMessage(eid *entity.ID) (*entity.Message, error)
    func (s *Storage) GetMessageDepth(m *entity.Message) (int, error)
    func (s *Storage) GetMessagesStoredAfter(ts time.Time, limit int) ([]*entity.StoredMessage, error)
    func (s *Storage) GetNearMessageID(m *entity.Message, diff time.Duration) (*entity.ID, error)
    func (s *Storage) GetOperation(oid *entity.ID) (*entity.Operation, error)
    func (s *Storage) GetOperationsOnMessage(mid *entity.ID) ([]*entity.Operation, error)
    func (s *Storage) GetOperationsOnUser(uid *entity.ID) ([]*entity.Operation, error)
    func (s *Storage) GetOperationsStoredAfter(ts time.Time, limit int) ([]*entity.StoredOperation, error)
    func (s *Storage) GetRoot(m *entity.Message) (*entity.Message, error)
    func (s *Storage) GetRootMessages(offset, limit int) ([]*entity.Message, error)
    func (s *Storage) GetThread(root *entity.ID) (*thread.Node, error)
    func (s *Storage) GetTopicMessages(topic subs.Topic, offset, limit int) ([]*entity.Message, error)
    func (s *Storage) GetUser(eid *entity.ID) (*entity.User, error)
    func (s *Storage) HasEntity(eid *entity.ID) (bool, error)
    func (s *Storage) HasMessage(id *entity.ID) (bool, error)
    func (s *Storage) HasUser(id *entity.ID) (bool, error)
    func (s *Storage) PutEntity(ent entity.Entity, sender chan<- entity.Entity) error

Package files

storage.go

type Storage

Storage is a mediator between Owner and Peers. It provides subscriptions to new entities and functions for managing entities.

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

func New

func New(db *sqlite.EntityDatabase) *Storage

func (*Storage) AttachObserver

func (s *Storage) AttachObserver(c chan<- entity.Entity)

func (*Storage) Close

func (s *Storage) Close() error

func (*Storage) DetachObserver

func (s *Storage) DetachObserver(c chan<- entity.Entity)

func (*Storage) GetEntity

func (s *Storage) GetEntity(eid *entity.ID) (entity.Entity, error)

func (*Storage) GetMessage

func (s *Storage) GetMessage(eid *entity.ID) (*entity.Message, error)

func (*Storage) GetMessageDepth

func (s *Storage) GetMessageDepth(m *entity.Message) (int, error)

func (*Storage) GetMessagesStoredAfter

func (s *Storage) GetMessagesStoredAfter(ts time.Time, limit int) ([]*entity.StoredMessage, error)

func (*Storage) GetNearMessageID

func (s *Storage) GetNearMessageID(m *entity.Message, diff time.Duration) (*entity.ID, error)

func (*Storage) GetOperation

func (s *Storage) GetOperation(oid *entity.ID) (*entity.Operation, error)

func (*Storage) GetOperationsOnMessage

func (s *Storage) GetOperationsOnMessage(mid *entity.ID) ([]*entity.Operation, error)

func (*Storage) GetOperationsOnUser

func (s *Storage) GetOperationsOnUser(uid *entity.ID) ([]*entity.Operation, error)

func (*Storage) GetOperationsStoredAfter

func (s *Storage) GetOperationsStoredAfter(ts time.Time, limit int) ([]*entity.StoredOperation, error)

func (*Storage) GetRoot

func (s *Storage) GetRoot(m *entity.Message) (*entity.Message, error)

func (*Storage) GetRootMessages

func (s *Storage) GetRootMessages(offset, limit int) ([]*entity.Message, error)

func (*Storage) GetThread

func (s *Storage) GetThread(root *entity.ID) (*thread.Node, error)

func (*Storage) GetTopicMessages

func (s *Storage) GetTopicMessages(topic subs.Topic, offset, limit int) ([]*entity.Message, error)

func (*Storage) GetUser

func (s *Storage) GetUser(eid *entity.ID) (*entity.User, error)

func (*Storage) HasEntity

func (s *Storage) HasEntity(eid *entity.ID) (bool, error)

func (*Storage) HasMessage

func (s *Storage) HasMessage(id *entity.ID) (bool, error)

func (*Storage) HasUser

func (s *Storage) HasUser(id *entity.ID) (bool, error)

func (*Storage) PutEntity

func (s *Storage) PutEntity(ent entity.Entity, sender chan<- entity.Entity) error