storage

package
v0.0.0-...-48c56db Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2021 License: BSD-3-Clause Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultTopReacjis = []keybase1.UserReacji{
	{Name: ":+1:"},
	{Name: ":-1:"},
	{Name: ":joy:"},
	{Name: ":sunglasses:"},
	{Name: ":tada:"},
}

If the user has less than 5 favorite reacjis we stuff these defaults in.

Functions

func CheckAndRecordBodyHash

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

CheckAndRecordBodyHash checks 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

CheckAndRecordPrevPointer checks 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 DeriveOutboxID

func DeriveOutboxID(dat []byte) chat1.OutboxID

func EmojiAliasList

func EmojiAliasList(shortCode string) []string

func EmojiExists

func EmojiExists(shortCode string) bool

EmojiExists flags if the given `shortCode` is a valid emoji

func EmojiHasAlias

func EmojiHasAlias(shortCode string) bool

EmojiHasAlias flags if the given `shortCode` has multiple aliases with other codes.

func GetOutboxIDFromURL

func GetOutboxIDFromURL(url string, convID chat1.ConversationID, msg chat1.MessageUnboxed) chat1.OutboxID

func GetSecretBoxKey

func GetSecretBoxKey(ctx context.Context, g *libkb.GlobalContext) (fkey [32]byte, err error)

func GetSecretBoxKeyWithUID

func GetSecretBoxKeyWithUID(ctx context.Context, g *libkb.GlobalContext, uid gregor1.UID) (fkey [32]byte, err error)

func LayoutChangedNotifier

func LayoutChangedNotifier(notifier InboxLayoutChangedNotifier) func(*Inbox)

func MakeConvID

func MakeConvID() chat1.ConversationID

func MakeConversation

func MakeConversation(maxID chat1.MessageID) chat1.Conversation

func MakeConversationAt

func MakeConversationAt(convID chat1.ConversationID, maxID chat1.MessageID) chat1.Conversation

func MakeDelete

func MakeDelete(id chat1.MessageID, originalMessage chat1.MessageID, allEdits []chat1.MessageID) chat1.MessageUnboxed

func MakeDeleteHistory

func MakeDeleteHistory(id chat1.MessageID, upto chat1.MessageID) chat1.MessageUnboxed

func MakeEdit

func MakeEdit(id chat1.MessageID, supersedes chat1.MessageID) chat1.MessageUnboxed

func MakeEphemeralEdit

func MakeEphemeralEdit(id chat1.MessageID, supersedes chat1.MessageID, ephemeralMetadata *chat1.MsgEphemeralMetadata, now gregor1.Time) chat1.MessageUnboxed

func MakeEphemeralText

func MakeEphemeralText(id chat1.MessageID, text string, ephemeralMetadata *chat1.MsgEphemeralMetadata, now gregor1.Time) chat1.MessageUnboxed

func MakeHeadlineMessage

func MakeHeadlineMessage(id chat1.MessageID) chat1.MessageUnboxed

func MakeMsgWithType

func MakeMsgWithType(id chat1.MessageID, typ chat1.MessageType) chat1.MessageUnboxed

func MakeText

func MakeText(id chat1.MessageID, text string) chat1.MessageUnboxed

func NewMessageNotifier

func NewMessageNotifier(n OutboxNewMessageNotifierFn) func(*Outbox)

func NewOutboxID

func NewOutboxID() (chat1.OutboxID, error)

func NormalizeShortCode

func NormalizeShortCode(shortCode string) string

NormalizeShortCode normalizes a given `shortCode` to a deterministic alias.

func PendingPreviewer

func PendingPreviewer(p OutboxPendingPreviewFn) func(*Outbox)

func SetupGlobalHooks

func SetupGlobalHooks(g *globals.Context)

func SortMessagesDesc

func SortMessagesDesc(msgs []chat1.MessageUnboxed) []chat1.MessageUnboxed

Sort messages by ID descending

Types

type AbortedError

type AbortedError struct{}

func NewAbortedError

func NewAbortedError() AbortedError

func (AbortedError) Error

func (e AbortedError) Error() string

func (AbortedError) Message

func (e AbortedError) Message() string

func (AbortedError) ShouldClear

func (e AbortedError) ShouldClear() bool

type AssetDeleter

type AssetDeleter interface {
	DeleteAssets(ctx context.Context, uid gregor1.UID, convID chat1.ConversationID, assets []chat1.Asset)
}

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 DummyAssetDeleter

type DummyAssetDeleter struct{}

func (DummyAssetDeleter) DeleteAssets

func (d DummyAssetDeleter) DeleteAssets(ctx context.Context, uid gregor1.UID, convID chat1.ConversationID,
	assets []chat1.Asset)

type Error

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

type FetchResult

type FetchResult struct {
	Thread   chat1.ThreadView
	Exploded []chat1.MessageUnboxed
}

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, config ...func(*Inbox)) *Inbox

func (*Inbox) Clear

func (i *Inbox) Clear(ctx context.Context, uid gregor1.UID) (err Error)

func (*Inbox) ClearInMemory

func (i *Inbox) ClearInMemory(ctx context.Context, uid gregor1.UID) (err Error)

func (*Inbox) ConversationsUpdate

func (i *Inbox) ConversationsUpdate(ctx context.Context, uid gregor1.UID, vers chat1.InboxVers,
	convUpdates []chat1.ConversationUpdate) (err Error)

func (*Inbox) Draft

func (i *Inbox) Draft(ctx context.Context, uid gregor1.UID, convID chat1.ConversationID,
	text *string) (modified bool, err Error)

func (*Inbox) Expunge

func (i *Inbox) Expunge(ctx context.Context, uid gregor1.UID, vers chat1.InboxVers,
	convID chat1.ConversationID, expunge chat1.Expunge, maxMsgs []chat1.MessageSummary) (err Error)

Mark the expunge on the stored inbox The inbox Expunge tag is kept up to date for retention but not for delete-history. Does not delete any messages. Relies on separate server mechanism to delete clear max messages.

func (*Inbox) GetConversation

func (i *Inbox) GetConversation(ctx context.Context, uid gregor1.UID, convID chat1.ConversationID) (res types.RemoteConversation, err Error)

func (*Inbox) IncrementLocalConvVersion

func (i *Inbox) IncrementLocalConvVersion(ctx context.Context, uid gregor1.UID, convID chat1.ConversationID) (err Error)

func (*Inbox) MarkLocalRead

func (i *Inbox) MarkLocalRead(ctx context.Context, uid gregor1.UID, convID chat1.ConversationID,
	msgID chat1.MessageID) (err Error)

func (*Inbox) MembershipUpdate

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

func (*Inbox) Merge

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

Merge add/updates conversations into the inbox. If a given conversation is either missing from the inbox, or is of greater version than what is currently stored, we write it down. Otherwise, we ignore it. If the inbox is currently blank, then we write down the given inbox version.

func (*Inbox) MergeLocalMetadata

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

func (*Inbox) NewConversation

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

func (*Inbox) NewMessage

func (i *Inbox) NewMessage(ctx context.Context, uid gregor1.UID, vers chat1.InboxVers,
	convID chat1.ConversationID, msg chat1.MessageBoxed, maxMsgs []chat1.MessageSummary) (err Error)

func (*Inbox) Read

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

func (*Inbox) ReadAll

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

func (*Inbox) ReadMessage

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

func (*Inbox) ServerVersion

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

func (*Inbox) SetAppNotificationSettings

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

func (*Inbox) SetConvRetention

func (i *Inbox) SetConvRetention(ctx context.Context, uid gregor1.UID, vers chat1.InboxVers,
	convID chat1.ConversationID, policy chat1.RetentionPolicy) (err Error)

func (*Inbox) SetConvSettings

func (i *Inbox) SetConvSettings(ctx context.Context, uid gregor1.UID, vers chat1.InboxVers,
	convID chat1.ConversationID, convSettings *chat1.ConversationSettings) (err Error)

func (*Inbox) SetInboxLayoutChangedNotifier

func (i *Inbox) SetInboxLayoutChangedNotifier(notifier InboxLayoutChangedNotifier)

func (*Inbox) SetStatus

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

func (*Inbox) SetTeamRetention

func (i *Inbox) SetTeamRetention(ctx context.Context, uid gregor1.UID, vers chat1.InboxVers,
	teamID keybase1.TeamID, policy chat1.RetentionPolicy) (res []chat1.ConversationID, err Error)

Update any local conversations with this team ID.

func (*Inbox) SubteamRename

func (i *Inbox) SubteamRename(ctx context.Context, uid gregor1.UID, vers chat1.InboxVers,
	convIDs []chat1.ConversationID) (err Error)

func (*Inbox) Sync

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

func (*Inbox) TeamTypeChanged

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

func (*Inbox) TlfFinalize

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

func (*Inbox) UpdateInboxVersion

func (i *Inbox) UpdateInboxVersion(ctx context.Context, uid gregor1.UID, vers chat1.InboxVers) (err Error)

func (*Inbox) UpdateLocalMtime

func (i *Inbox) UpdateLocalMtime(ctx context.Context, uid gregor1.UID,
	convUpdates []chat1.LocalMtimeUpdate) (err Error)

func (*Inbox) UpgradeKBFSToImpteam

func (i *Inbox) UpgradeKBFSToImpteam(ctx context.Context, uid gregor1.UID, vers chat1.InboxVers,
	convID chat1.ConversationID) (err Error)

func (*Inbox) Version

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

type InboxFlushMode

type InboxFlushMode int
const (
	InboxFlushModeActive InboxFlushMode = iota
	InboxFlushModeDelegate
)

type InboxLayoutChangedNotifier

type InboxLayoutChangedNotifier interface {
	UpdateLayout(ctx context.Context, reselectMode chat1.InboxLayoutReselectMode, reason string)
	UpdateLayoutFromNewMessage(ctx context.Context, conv types.RemoteConversation)
	UpdateLayoutFromSubteamRename(ctx context.Context, convs []types.RemoteConversation)
}

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 InsatiableResultCollector

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

func NewInsatiableResultCollector

func NewInsatiableResultCollector() *InsatiableResultCollector

InsatiableResultCollector aggregates all messages all the way back. Its result can include holes.

func (*InsatiableResultCollector) Done

func (s *InsatiableResultCollector) Done() bool

func (*InsatiableResultCollector) Error

func (s *InsatiableResultCollector) Error(err Error) Error

func (*InsatiableResultCollector) Name

func (*InsatiableResultCollector) Push

func (*InsatiableResultCollector) PushPlaceholder

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

func (*InsatiableResultCollector) Result

func (*InsatiableResultCollector) SetTarget

func (s *InsatiableResultCollector) SetTarget(num int)

func (*InsatiableResultCollector) String

func (s *InsatiableResultCollector) String() string

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 MergeResult

type MergeResult struct {
	Expunged        *chat1.Expunge
	Exploded        []chat1.MessageUnboxed
	ReactionTargets []chat1.MessageUnboxed
	UnfurlTargets   []UnfurlMergeResult
	RepliesAffected []chat1.MessageUnboxed
}

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, config ...func(*Outbox)) *Outbox

func (*Outbox) AppendToThread

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

func (*Outbox) CancelMessagesWithPredicate

func (o *Outbox) CancelMessagesWithPredicate(ctx context.Context, shouldCancel func(chat1.OutboxRecord) bool) (int, error)

func (*Outbox) GetRecord

func (o *Outbox) GetRecord(ctx context.Context, outboxID chat1.OutboxID) (res chat1.OutboxRecord, err error)

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) (res chat1.OutboxRecord, err 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) MarkConvAsError

func (o *Outbox) MarkConvAsError(ctx context.Context, convID chat1.ConversationID,
	errRec chat1.OutboxStateError) (res []chat1.OutboxRecord, err error)

func (*Outbox) OutboxPurge

func (o *Outbox) OutboxPurge(ctx context.Context) (ephemeralPurged []chat1.OutboxRecord, err error)

OutboxPurge is called periodically to ensure messages don't hang out too long in the outbox (since they are not encrypted with ephemeral keys until they leave it). Currently we purge anything that is in the error state and has been in the outbox for > errorPurgeCutoff minutes for regular messages or ephemeralPurgeCutoff minutes for ephemeral messages.

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) PullForConversation

func (o *Outbox) PullForConversation(ctx context.Context, convID chat1.ConversationID) ([]chat1.OutboxRecord, error)

func (*Outbox) PushMessage

func (o *Outbox) PushMessage(ctx context.Context, convID chat1.ConversationID,
	msg chat1.MessagePlaintext, suppliedOutboxID *chat1.OutboxID,
	sendOpts *chat1.SenderSendOptions, prepareOpts *chat1.SenderPrepareOptions,
	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) (res chat1.OutboxRecord, err error)

func (*Outbox) RetryMessage

func (o *Outbox) RetryMessage(ctx context.Context, obid chat1.OutboxID,
	identifyBehavior *keybase1.TLFIdentifyBehavior) (res *chat1.OutboxRecord, err error)

func (*Outbox) SetClock

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

func (*Outbox) SetNewMessageNotifier

func (o *Outbox) SetNewMessageNotifier(n OutboxNewMessageNotifierFn)

func (*Outbox) SetPendingPreviewer

func (o *Outbox) SetPendingPreviewer(p OutboxPendingPreviewFn)

func (*Outbox) UpdateMessage

func (o *Outbox) UpdateMessage(ctx context.Context, replaceobr chat1.OutboxRecord) (updated bool, err error)

type OutboxNewMessageNotifierFn

type OutboxNewMessageNotifierFn func(context.Context, chat1.OutboxRecord)

type OutboxPendingPreviewFn

type OutboxPendingPreviewFn func(context.Context, *chat1.OutboxRecord) error

type PinIgnore

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

func NewPinIgnore

func NewPinIgnore(g *globals.Context, uid gregor1.UID) *PinIgnore

func (*PinIgnore) Ignore

func (p *PinIgnore) Ignore(ctx context.Context, convID chat1.ConversationID, msgID chat1.MessageID) error

func (*PinIgnore) IsIgnored

func (p *PinIgnore) IsIgnored(ctx context.Context, convID chat1.ConversationID, msgID chat1.MessageID) bool

type PrevChecker

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

type ReacjiInternalStorage

type ReacjiInternalStorage struct {
	FrequencyMap map[string]int
	MtimeMap     map[string]gregor1.Time
	SkinTone     keybase1.ReacjiSkinTone
}

func NewReacjiInternalStorage

func NewReacjiInternalStorage() ReacjiInternalStorage

type ReacjiStore

type ReacjiStore struct {
	globals.Contextified
	sync.Mutex
	utils.DebugLabeler
	// contains filtered or unexported fields
}

func NewReacjiStore

func NewReacjiStore(g *globals.Context) *ReacjiStore

Keeps map counting emoji used in reactions for each user. Used to populate the reacji heads up display. Data is stored in an encrypted leveldb in the form:

uid -> {
               reacjiName: frequency,
               ":+1:": 5,
               ...
        },

func (*ReacjiStore) GetInternalStore

func (s *ReacjiStore) GetInternalStore(ctx context.Context, uid gregor1.UID) ReacjiInternalStorage

func (*ReacjiStore) PutReacji

func (s *ReacjiStore) PutReacji(ctx context.Context, uid gregor1.UID, shortCode string) error

func (*ReacjiStore) PutSkinTone

func (s *ReacjiStore) PutSkinTone(ctx context.Context, uid gregor1.UID,
	skinTone keybase1.ReacjiSkinTone) error

func (*ReacjiStore) UserReacjis

func (s *ReacjiStore) UserReacjis(ctx context.Context, uid gregor1.UID) keybase1.UserReacjis

UserReacjis returns the user's most frequently used reacjis falling back to `DefaultTopReacjis` if there is not enough history. Results are ordered by frequency and then alphabetically.

type ReadOutbox

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

func NewReadOutbox

func NewReadOutbox(g *globals.Context, uid gregor1.UID) *ReadOutbox

func (*ReadOutbox) GetRecords

func (o *ReadOutbox) GetRecords(ctx context.Context) (res []ReadOutboxRecord, err Error)

func (*ReadOutbox) PushRead

func (o *ReadOutbox) PushRead(ctx context.Context, convID chat1.ConversationID, msgID chat1.MessageID) (err Error)

func (*ReadOutbox) RemoveRecord

func (o *ReadOutbox) RemoveRecord(ctx context.Context, id chat1.OutboxID) Error

type ReadOutboxRecord

type ReadOutboxRecord struct {
	ID     chat1.OutboxID
	ConvID chat1.ConversationID
	MsgID  chat1.MessageID
}

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
	SetTarget(num int)

	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 basic way. It is not thread safe.

func NewSimpleResultCollector

func NewSimpleResultCollector(num int, countAll bool) *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) SetTarget

func (s *SimpleResultCollector) SetTarget(num int)

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, assetDeleter AssetDeleter) *Storage

func (*Storage) ClearAll

func (s *Storage) ClearAll(ctx context.Context, convID chat1.ConversationID, uid gregor1.UID) (err Error)

func (*Storage) ClearBefore

func (s *Storage) ClearBefore(ctx context.Context, convID chat1.ConversationID, uid gregor1.UID,
	upto chat1.MessageID) (err Error)

ClearBefore clears all messages up to (but not including) the upto messageID

func (*Storage) EphemeralPurge

func (s *Storage) EphemeralPurge(ctx context.Context, convID chat1.ConversationID, uid gregor1.UID, purgeInfo *chat1.EphemeralPurgeInfo) (newPurgeInfo *chat1.EphemeralPurgeInfo, explodedMsgs []chat1.MessageUnboxed, err Error)

For a given conversation, purge all ephemeral messages from purgeInfo.MinUnexplodedID to the present, updating bookkeeping for the next time we need to purge this conv.

func (*Storage) Expunge

func (s *Storage) Expunge(ctx context.Context,
	conv types.UnboxConversationInfo, uid gregor1.UID, expunge chat1.Expunge) (res MergeResult, err Error)

func (*Storage) Fetch

func (s *Storage) Fetch(ctx context.Context, conv chat1.Conversation,
	uid gregor1.UID, rc ResultCollector, query *chat1.GetThreadQuery, pagination *chat1.Pagination) (res FetchResult, err Error)

func (*Storage) FetchMessages

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

func (*Storage) FetchUnreadlineID

func (s *Storage) FetchUnreadlineID(ctx context.Context, convID chat1.ConversationID,
	uid gregor1.UID, readMsgID chat1.MessageID) (msgID *chat1.MessageID, err Error)

func (*Storage) FetchUpToLocalMaxMsgID

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

func (*Storage) GetExplodedReplies

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

func (*Storage) GetMaxMsgID

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

func (*Storage) IsTLFIdentifyBroken

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

func (*Storage) Merge

func (s *Storage) Merge(ctx context.Context,
	conv types.UnboxConversationInfo, uid gregor1.UID, msgs []chat1.MessageUnboxed) (res MergeResult, err Error)

Merge requires msgs to be sorted by descending message ID

func (*Storage) MergeHelper

func (s *Storage) MergeHelper(ctx context.Context,
	conv types.UnboxConversationInfo, uid gregor1.UID, msgs []chat1.MessageUnboxed, expunge *chat1.Expunge) (res MergeResult, err Error)

MergeHelper requires msgs to be sorted by descending message ID expunge is optional

func (*Storage) Nuke

func (s *Storage) Nuke(ctx context.Context, convID chat1.ConversationID, uid gregor1.UID) Error

func (*Storage) ResultCollectorFromQuery

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

func (*Storage) SetAssetDeleter

func (s *Storage) SetAssetDeleter(assetDeleter AssetDeleter)

func (*Storage) SetClock

func (s *Storage) SetClock(clock clockwork.Clock)

func (*Storage) SetMaxMsgID

func (s *Storage) SetMaxMsgID(ctx context.Context, convID chat1.ConversationID, uid gregor1.UID,
	msgID chat1.MessageID) (err Error)

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 constraints. 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) SetTarget

func (t *TypedResultCollector) SetTarget(num int)

func (*TypedResultCollector) String

func (t *TypedResultCollector) String() string

type UnfurlMergeResult

type UnfurlMergeResult struct {
	Msg         chat1.MessageUnboxed
	IsMapDelete bool
}

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