storage

package
v1.0.39 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2017 License: BSD-3-Clause, BSD-3-Clause Imports: 22 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultSecretUI = func() libkb.SecretUI { return SecretUI{} }

Functions

func CheckAndRecordBodyHash

func CheckAndRecordBodyHash(ctx context.Context, g *globals.Context, bodyHash chat1.Hash, uniqueMsgID chat1.MessageID, uniqueConvID chat1.ConversationID) error

Check the current message's body hash against all the body hashes we've seen, to prevent replays. If the header hash is new, add it to the set.

func CheckAndRecordPrevPointer

func CheckAndRecordPrevPointer(ctx context.Context, g *globals.Context, msgID chat1.MessageID, convID chat1.ConversationID, uniqueHeaderHash chat1.Hash) error

Check the current message's header hash against all the prev pointers we've ever seen. If the current message is new, add it to the set.

func NewOutboxID

func NewOutboxID() (chat1.OutboxID, error)

Types

type BodyHashChecker

type BodyHashChecker func(bodyHash chat1.Hash, uniqueMsgID chat1.MessageID, uniqueConvID chat1.ConversationID) error

type ByCtimeOrder

type ByCtimeOrder []chat1.OutboxRecord

func (ByCtimeOrder) Len

func (a ByCtimeOrder) Len() int

func (ByCtimeOrder) Less

func (a ByCtimeOrder) Less(i, j int) bool

func (ByCtimeOrder) Swap

func (a ByCtimeOrder) Swap(i, j int)

type ByDatabaseOrder

type ByDatabaseOrder []types.RemoteConversation

func (ByDatabaseOrder) Len

func (a ByDatabaseOrder) Len() int

func (ByDatabaseOrder) Less

func (a ByDatabaseOrder) Less(i, j int) bool

func (ByDatabaseOrder) Swap

func (a ByDatabaseOrder) Swap(i, j int)

type Error

type Error interface {
	error
	ShouldClear() bool
	Message() string
}

type HoleyResultCollector

type HoleyResultCollector struct {
	ResultCollector
	// contains filtered or unexported fields
}

func NewHoleyResultCollector

func NewHoleyResultCollector(maxHoles int, rc ResultCollector) *HoleyResultCollector

func (*HoleyResultCollector) Holes

func (h *HoleyResultCollector) Holes() int

func (*HoleyResultCollector) PushPlaceholder

func (h *HoleyResultCollector) PushPlaceholder(msgID chat1.MessageID) bool

type Inbox

type Inbox struct {
	globals.Contextified

	utils.DebugLabeler
	// contains filtered or unexported fields
}

func NewInbox

func NewInbox(g *globals.Context, uid gregor1.UID) *Inbox

func (*Inbox) Clear

func (i *Inbox) Clear(ctx context.Context) (err Error)

func (*Inbox) MembershipUpdate

func (i *Inbox) MembershipUpdate(ctx context.Context, vers chat1.InboxVers,
	userJoined []chat1.Conversation, userRemoved []chat1.ConversationID,
	othersJoined []chat1.ConversationMember, othersRemoved []chat1.ConversationMember,
	userReset []chat1.ConversationID, othersReset []chat1.ConversationMember) (err Error)

func (*Inbox) Merge

func (i *Inbox) Merge(ctx context.Context, vers chat1.InboxVers, convsIn []chat1.Conversation,
	query *chat1.GetInboxQuery, p *chat1.Pagination) (err Error)

func (*Inbox) MergeLocalMetadata

func (i *Inbox) MergeLocalMetadata(ctx context.Context, convs []chat1.ConversationLocal) (err Error)

func (*Inbox) NewConversation

func (i *Inbox) NewConversation(ctx context.Context, vers chat1.InboxVers, conv chat1.Conversation) (err Error)

func (*Inbox) NewMessage

func (i *Inbox) NewMessage(ctx context.Context, vers chat1.InboxVers, convID chat1.ConversationID,
	msg chat1.MessageBoxed) (err Error)

func (*Inbox) Read

func (i *Inbox) Read(ctx context.Context, query *chat1.GetInboxQuery, p *chat1.Pagination) (vers chat1.InboxVers, res []types.RemoteConversation, pagination *chat1.Pagination, err Error)

func (*Inbox) ReadAll

func (i *Inbox) ReadAll(ctx context.Context) (vers chat1.InboxVers, res []types.RemoteConversation, err Error)

func (*Inbox) ReadMessage

func (i *Inbox) ReadMessage(ctx context.Context, vers chat1.InboxVers, convID chat1.ConversationID,
	msgID chat1.MessageID) (err Error)

func (*Inbox) ServerVersion

func (i *Inbox) ServerVersion(ctx context.Context) (vers int, err Error)

func (*Inbox) SetAppNotificationSettings

func (i *Inbox) SetAppNotificationSettings(ctx context.Context, vers chat1.InboxVers,
	convID chat1.ConversationID, settings chat1.ConversationNotificationInfo) (err Error)

func (*Inbox) SetStatus

func (i *Inbox) SetStatus(ctx context.Context, vers chat1.InboxVers, convID chat1.ConversationID,
	status chat1.ConversationStatus) (err Error)

func (*Inbox) Sync

func (i *Inbox) Sync(ctx context.Context, vers chat1.InboxVers, convs []chat1.Conversation) (res InboxSyncRes, err Error)

func (*Inbox) TeamTypeChanged

func (i *Inbox) TeamTypeChanged(ctx context.Context, vers chat1.InboxVers,
	convID chat1.ConversationID, teamType chat1.TeamType, notifInfo *chat1.ConversationNotificationInfo) (err Error)

func (*Inbox) TlfFinalize

func (i *Inbox) TlfFinalize(ctx context.Context, vers chat1.InboxVers, convIDs []chat1.ConversationID,
	finalizeInfo chat1.ConversationFinalizeInfo) (err Error)

func (*Inbox) Version

func (i *Inbox) Version(ctx context.Context) (vers chat1.InboxVers, err Error)

type InboxSyncRes

type InboxSyncRes struct {
	TeamTypeChanged bool
}

type InboxVersionSource

type InboxVersionSource struct {
	globals.Contextified
}

func NewInboxVersionSource

func NewInboxVersionSource(g *globals.Context) *InboxVersionSource

func (*InboxVersionSource) GetInboxVersion

func (i *InboxVersionSource) GetInboxVersion(ctx context.Context, uid gregor1.UID) (chat1.InboxVers, error)

type InternalError

type InternalError struct {
	Msg string
}

func NewInternalError

func NewInternalError(ctx context.Context, d utils.DebugLabeler, msg string, args ...interface{}) InternalError

func (InternalError) Error

func (e InternalError) Error() string

func (InternalError) Message

func (e InternalError) Message() string

func (InternalError) ShouldClear

func (e InternalError) ShouldClear() bool

type MiscError

type MiscError struct {
	Msg string
}

func (MiscError) Error

func (e MiscError) Error() string

func (MiscError) Message

func (e MiscError) Message() string

func (MiscError) ShouldClear

func (e MiscError) ShouldClear() bool

type MissError

type MissError struct {
	Msg string
}

func (MissError) Error

func (e MissError) Error() string

func (MissError) Message

func (e MissError) Message() string

func (MissError) ShouldClear

func (e MissError) ShouldClear() bool

type Outbox

type Outbox struct {
	globals.Contextified

	utils.DebugLabeler
	// contains filtered or unexported fields
}

func NewOutbox

func NewOutbox(g *globals.Context, uid gregor1.UID) *Outbox

func (*Outbox) GetUID

func (o *Outbox) GetUID() gregor1.UID

func (*Outbox) MarkAsError

func (o *Outbox) MarkAsError(ctx context.Context, obr chat1.OutboxRecord, errRec chat1.OutboxStateError) error

MarkAsError will either mark an existing record as an error, or it will add the passed record as an error with the specified error state

func (*Outbox) PullAllConversations

func (o *Outbox) PullAllConversations(ctx context.Context, includeErrors bool, remove bool) ([]chat1.OutboxRecord, error)

PullAllConversations grabs all outbox entries for the current outbox, and optionally deletes them from storage

func (*Outbox) PushMessage

func (o *Outbox) PushMessage(ctx context.Context, convID chat1.ConversationID,
	msg chat1.MessagePlaintext, suppliedOutboxID *chat1.OutboxID,
	identifyBehavior keybase1.TLFIdentifyBehavior) (rec chat1.OutboxRecord, err Error)

func (*Outbox) RecordFailedAttempt

func (o *Outbox) RecordFailedAttempt(ctx context.Context, oldObr chat1.OutboxRecord) error

RecordFailedAttempt will either modify an existing matching record (if sending) to next attempt number, or if the record doesn't exist it adds it in.

func (*Outbox) RemoveMessage

func (o *Outbox) RemoveMessage(ctx context.Context, obid chat1.OutboxID) error

func (*Outbox) RetryMessage

func (o *Outbox) RetryMessage(ctx context.Context, obid chat1.OutboxID) error

func (*Outbox) SetClock

func (o *Outbox) SetClock(cl clockwork.Clock)

func (*Outbox) SprinkleIntoThread

func (o *Outbox) SprinkleIntoThread(ctx context.Context, convID chat1.ConversationID,
	thread *chat1.ThreadView) error

type PrevChecker

type PrevChecker func(msgID chat1.MessageID, convID chat1.ConversationID, uniqueHeaderHash chat1.Hash) error

type RemoteError

type RemoteError struct {
	Msg string
}

func (RemoteError) Error

func (e RemoteError) Error() string

func (RemoteError) Message

func (e RemoteError) Message() string

func (RemoteError) ShouldClear

func (e RemoteError) ShouldClear() bool

type ResultCollector

type ResultCollector interface {
	Push(msg chat1.MessageUnboxed)
	PushPlaceholder(msgID chat1.MessageID) bool
	Done() bool
	Result() []chat1.MessageUnboxed
	Error(err Error) Error
	Name() string

	String() string
}

type SecretUI

type SecretUI struct {
}

func (SecretUI) GetPassphrase

func (d SecretUI) GetPassphrase(pinentry keybase1.GUIEntryArg, terminal *keybase1.SecretEntryArg) (keybase1.GetPassphraseRes, error)

type ServerVersions

type ServerVersions struct {
	globals.Contextified
	utils.DebugLabeler
	// contains filtered or unexported fields
}

func NewServerVersions

func NewServerVersions(g *globals.Context) *ServerVersions

func (*ServerVersions) Fetch

func (*ServerVersions) MatchBodies

func (s *ServerVersions) MatchBodies(ctx context.Context, vers int) (int, error)

func (*ServerVersions) MatchInbox

func (s *ServerVersions) MatchInbox(ctx context.Context, vers int) (int, error)

func (*ServerVersions) Set

func (s *ServerVersions) Set(ctx context.Context, vers chat1.ServerCacheVers) (err error)

type SimpleResultCollector

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

SimpleResultCollector aggregates all results in a the basic way. It is not thread safe.

func NewSimpleResultCollector

func NewSimpleResultCollector(num int) *SimpleResultCollector

func (*SimpleResultCollector) Done

func (s *SimpleResultCollector) Done() bool

func (*SimpleResultCollector) Error

func (s *SimpleResultCollector) Error(err Error) Error

func (*SimpleResultCollector) Name

func (s *SimpleResultCollector) Name() string

func (*SimpleResultCollector) Push

func (*SimpleResultCollector) PushPlaceholder

func (s *SimpleResultCollector) PushPlaceholder(chat1.MessageID) bool

func (*SimpleResultCollector) Result

func (*SimpleResultCollector) String

func (s *SimpleResultCollector) String() string

type Storage

type Storage struct {
	globals.Contextified
	utils.DebugLabeler
	// contains filtered or unexported fields
}

func New

func New(g *globals.Context) *Storage

func (*Storage) Fetch

func (*Storage) FetchMessages

func (s *Storage) FetchMessages(ctx context.Context, convID chat1.ConversationID,
	uid gregor1.UID, msgIDs []chat1.MessageID) ([]*chat1.MessageUnboxed, error)

func (*Storage) FetchUpToLocalMaxMsgID

func (s *Storage) FetchUpToLocalMaxMsgID(ctx context.Context,
	convID chat1.ConversationID, uid gregor1.UID, rc ResultCollector, query *chat1.GetThreadQuery,
	pagination *chat1.Pagination) (chat1.ThreadView, Error)

func (*Storage) GetMaxMsgID

func (s *Storage) GetMaxMsgID(ctx context.Context, convID chat1.ConversationID, uid gregor1.UID) (chat1.MessageID, error)

func (*Storage) IsTLFIdentifyBroken

func (s *Storage) IsTLFIdentifyBroken(ctx context.Context, tlfID chat1.TLFID) bool

func (*Storage) MaybeNuke

func (s *Storage) MaybeNuke(force bool, err Error, convID chat1.ConversationID, uid gregor1.UID) Error

func (*Storage) Merge

func (s *Storage) Merge(ctx context.Context, convID chat1.ConversationID, uid gregor1.UID, msgs []chat1.MessageUnboxed) Error

func (*Storage) ResultCollectorFromQuery

func (s *Storage) ResultCollectorFromQuery(ctx context.Context, query *chat1.GetThreadQuery,
	pagination *chat1.Pagination) ResultCollector

func (*Storage) UpdateTLFIdentifyBreak

func (s *Storage) UpdateTLFIdentifyBreak(ctx context.Context, tlfID chat1.TLFID,
	breaks []keybase1.TLFIdentifyFailure) error

type TypedResultCollector

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

TypedResultCollector aggregates results with a type contraints. It is not thread safe.

func NewTypedResultCollector

func NewTypedResultCollector(num int, typs []chat1.MessageType) *TypedResultCollector

func (*TypedResultCollector) Done

func (t *TypedResultCollector) Done() bool

func (*TypedResultCollector) Error

func (t *TypedResultCollector) Error(err Error) Error

func (*TypedResultCollector) Name

func (t *TypedResultCollector) Name() string

func (*TypedResultCollector) Push

func (*TypedResultCollector) PushPlaceholder

func (t *TypedResultCollector) PushPlaceholder(msgID chat1.MessageID) bool

func (*TypedResultCollector) Result

func (*TypedResultCollector) String

func (t *TypedResultCollector) String() string

type VersionMismatchError

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

func NewVersionMismatchError

func NewVersionMismatchError(oldVers chat1.InboxVers, newVers chat1.InboxVers) VersionMismatchError

func (VersionMismatchError) Error

func (e VersionMismatchError) Error() string

func (VersionMismatchError) Message

func (e VersionMismatchError) Message() string

func (VersionMismatchError) ShouldClear

func (e VersionMismatchError) ShouldClear() bool

Jump to

Keyboard shortcuts

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