Documentation ¶
Index ¶
- Constants
- func Authenticate(wt WebTokenStore, args map[string]string) error
- func BuildByteWal(el []EventLog) (*bytes.Buffer, error)
- func BuildWalFromPlainText(ctx context.Context, wf WalFile, r io.Reader, isHidden bool) error
- func GetCommonSearchPrefixAndFriends(selectedItems map[string]ListItem) [][]rune
- func GetNewLinePrefix(search [][]rune) string
- func MatchFirstURL(line string, ensureScheme bool) string
- func Min(a, b int) int
- func ParseOperatorGroups(sub string) string
- type Client
- type ClientBase
- func (t *ClientBase) GetSearchGroupIdxAndOffset() (int, int)
- func (t *ClientBase) GetUnsearchedFriends(friends []string) []string
- func (t *ClientBase) HandleInteraction(ev InteractionEvent, search [][]rune, showHidden bool, bypassRefresh bool, ...) ([]ListItem, bool, error)
- func (t *ClientBase) TrimPrefix(line string) string
- type DBListRepo
- func (r *DBListRepo) Add(line string, note []byte, childItem *ListItem) (string, error)
- func (r *DBListRepo) AddWalFile(wf WalFile, hasFullAccess bool)
- func (r *DBListRepo) DebugWriteEventsToFile(filename string, key string)
- func (r *DBListRepo) Delete(item *ListItem) (string, error)
- func (r *DBListRepo) DeleteWalFile(name string)
- func (r *DBListRepo) EmitCursorMoveEvent(key string)
- func (r *DBListRepo) ExportToPlainText(matchKeys [][]rune, showHidden bool) error
- func (r *DBListRepo) ForceTriggerFlush()
- func (r *DBListRepo) GetCollabPositions() map[string][]string
- func (r *DBListRepo) GetFriendFromConfig(item ListItem) (string, bool)
- func (r *DBListRepo) GetFriendState(f string) FriendState
- func (r *DBListRepo) GetListItem(key string) (ListItem, bool)
- func (r *DBListRepo) GetListItemNote(key string) []byte
- func (r *DBListRepo) GetSyncState() SyncState
- func (r *DBListRepo) IsSynced() bool
- func (r *DBListRepo) Match(keys [][]rune, showHidden bool, curKey string, offset int, limit int) ([]ListItem, int, error)
- func (r *DBListRepo) MoveDown(item *ListItem) error
- func (r *DBListRepo) MoveUp(item *ListItem) error
- func (r *DBListRepo) Redo() (string, error)
- func (r *DBListRepo) Replay(partialWal []EventLog) error
- func (r *DBListRepo) SaveListItemNote(key string, note []byte)
- func (r *DBListRepo) SetCollabPosition(ev cursorMoveEvent) bool
- func (r *DBListRepo) Start(client Client) error
- func (r *DBListRepo) TestPullLocal(c chan namedWal) error
- func (r *DBListRepo) ToggleVisibility(item *ListItem) (string, error)
- func (r *DBListRepo) Undo() (string, error)
- func (r *DBListRepo) Update(line string, item *ListItem) error
- func (r *DBListRepo) UpdateNote(note []byte, item *ListItem) error
- type DbEventLogger
- type EventLog
- type EventLogSchema4
- type EventLogSchema5
- type EventLogSchema6
- type EventType
- type FileWebTokenStore
- func (wt *FileWebTokenStore) Email() string
- func (wt *FileWebTokenStore) Flush()
- func (wt *FileWebTokenStore) IDToken() string
- func (wt *FileWebTokenStore) RefreshToken() string
- func (wt *FileWebTokenStore) SetEmail(s string)
- func (wt *FileWebTokenStore) SetIDToken(s string)
- func (wt *FileWebTokenStore) SetRefreshToken(s string)
- type FinishWithPurgeError
- type FriendState
- type InteractionEvent
- type InteractionEventType
- type LegacyListItem
- type LineFriends
- type LineFriendsSchema4
- type ListItem
- type LocalFileWalFile
- func (wf *LocalFileWalFile) Flush(ctx context.Context, b *bytes.Buffer, randomUUID string) error
- func (wf *LocalFileWalFile) GetMatchingWals(ctx context.Context, matchPattern string) ([]string, error)
- func (wf *LocalFileWalFile) GetRoot() string
- func (wf *LocalFileWalFile) GetUUID() string
- func (wf *LocalFileWalFile) GetWalBytes(ctx context.Context, w io.Writer, fileName string) error
- func (wf *LocalFileWalFile) Purge()
- func (wf *LocalFileWalFile) RemoveWals(ctx context.Context, fileNames []string) error
- type LocalWalFile
- type MatchPattern
- type RefreshKey
- type SyncEvent
- type SyncState
- type WalFile
- type Web
- type WebRemote
- type WebTokenStore
- type WebWalFile
- func (wf *WebWalFile) Flush(ctx context.Context, b *bytes.Buffer, checksum string) error
- func (wf *WebWalFile) GetMatchingWals(ctx context.Context, pattern string) ([]string, error)
- func (wf *WebWalFile) GetRoot() string
- func (wf *WebWalFile) GetUUID() string
- func (wf *WebWalFile) GetWalBytes(ctx context.Context, w io.Writer, fileName string) error
- func (wf *WebWalFile) RemoveWals(ctx context.Context, fileNames []string) error
Constants ¶
const LatestWalSchemaID uint16 = 7
IMPORTANT: bump cloud version
Variables ¶
This section is empty.
Functions ¶
func Authenticate ¶
func Authenticate(wt WebTokenStore, args map[string]string) error
func BuildWalFromPlainText ¶
BuildWalFromPlainText accepts an io.Reader with line separated plain text, and generates a wal db file which is dumped in fzn root directory.
func GetCommonSearchPrefixAndFriends ¶ added in v0.22.0
func GetNewLinePrefix ¶
func MatchFirstURL ¶ added in v0.22.0
func ParseOperatorGroups ¶ added in v0.22.0
Types ¶
type ClientBase ¶ added in v0.22.0
type ClientBase struct { Search [][]rune CurItem *ListItem // The currently selected item Editor string W, H int ReservedTopLines, ReservedBottomLines int CurX, CurY int // Cur "screen" index, not related to matched item lists VertOffset int // The index of the first displayed item in the match set HorizOffset int // The index of the first displayed char in the curItem ShowHidden bool SelectedItems map[string]ListItem HiddenMatchPrefix string // The common string that we want to truncate from each line // contains filtered or unexported fields }
ClientBase ...
func NewClientBase ¶ added in v0.22.0
func NewClientBase(db *DBListRepo, maxWidth int, maxHeight int, useClientSearch bool) *ClientBase
NewClientBase ...
func (*ClientBase) GetSearchGroupIdxAndOffset ¶ added in v0.22.0
func (t *ClientBase) GetSearchGroupIdxAndOffset() (int, int)
GetSearchGroupIdxAndOffset returns the group index and offset within that group, respectively. This might have unpredictable results if called on non-search lines (e.g. when CurY != 0)
func (*ClientBase) GetUnsearchedFriends ¶ added in v0.22.0
func (t *ClientBase) GetUnsearchedFriends(friends []string) []string
func (*ClientBase) HandleInteraction ¶ added in v0.22.0
func (t *ClientBase) HandleInteraction(ev InteractionEvent, search [][]rune, showHidden bool, bypassRefresh bool, limit int) ([]ListItem, bool, error)
TODO rename "t"
func (*ClientBase) TrimPrefix ¶ added in v0.22.0
func (t *ClientBase) TrimPrefix(line string) string
TrimPrefix ...
type DBListRepo ¶
type DBListRepo struct { // TODO better naming convention LocalWalFile LocalWalFile // contains filtered or unexported fields }
func NewDBListRepo ¶
func NewDBListRepo(localWalFile LocalWalFile, webTokenStore WebTokenStore) *DBListRepo
NewDBListRepo returns a pointer to a new instance of DBListRepo
func (*DBListRepo) Add ¶
Add adds a new LineItem with string, note and a position to insert the item into the matched list It returns a string representing the unique key of the newly created item
func (*DBListRepo) AddWalFile ¶ added in v0.22.0
func (r *DBListRepo) AddWalFile(wf WalFile, hasFullAccess bool)
func (*DBListRepo) DebugWriteEventsToFile ¶ added in v0.22.0
func (r *DBListRepo) DebugWriteEventsToFile(filename string, key string)
DebugWriteEventsToFile is used for debug purposes. It prints all events for the given uuid/lamportTimestamp combination to file, for inspection
func (*DBListRepo) Delete ¶
func (r *DBListRepo) Delete(item *ListItem) (string, error)
Delete will remove an existing ListItem
func (*DBListRepo) DeleteWalFile ¶ added in v0.22.0
func (r *DBListRepo) DeleteWalFile(name string)
func (*DBListRepo) EmitCursorMoveEvent ¶ added in v0.22.0
func (r *DBListRepo) EmitCursorMoveEvent(key string)
func (*DBListRepo) ExportToPlainText ¶
func (r *DBListRepo) ExportToPlainText(matchKeys [][]rune, showHidden bool) error
func (*DBListRepo) ForceTriggerFlush ¶ added in v0.23.0
func (r *DBListRepo) ForceTriggerFlush()
ForceTriggerFlush will zero the flush timer, and block til completion. E.g. this is a synchronous flush
func (*DBListRepo) GetCollabPositions ¶
func (r *DBListRepo) GetCollabPositions() map[string][]string
GetCollabPositions returns a map of listItemKeys against all collaborators currently on that listItem
func (*DBListRepo) GetFriendFromConfig ¶ added in v0.24.0
func (r *DBListRepo) GetFriendFromConfig(item ListItem) (string, bool)
func (*DBListRepo) GetFriendState ¶ added in v0.24.0
func (r *DBListRepo) GetFriendState(f string) FriendState
func (*DBListRepo) GetListItem ¶ added in v0.22.0
func (r *DBListRepo) GetListItem(key string) (ListItem, bool)
func (*DBListRepo) GetListItemNote ¶ added in v0.22.0
func (r *DBListRepo) GetListItemNote(key string) []byte
func (*DBListRepo) GetSyncState ¶ added in v0.24.0
func (r *DBListRepo) GetSyncState() SyncState
func (*DBListRepo) IsSynced ¶ added in v0.23.0
func (r *DBListRepo) IsSynced() bool
IsSynced is a boolean value defining whether or now there are currently events held in memory that are yet to be flushed to local storage
func (*DBListRepo) Match ¶
func (r *DBListRepo) Match(keys [][]rune, showHidden bool, curKey string, offset int, limit int) ([]ListItem, int, error)
Match takes a set of search groups and applies each to all ListItems, returning those that fulfil all rules. `showHidden` dictates whether or not hidden items are returned. `curKey` is used to identify the currently selected item. `offset` and `limit` can be passed to paginate over the match-set, if `limit==0`, all matches from `offset` will be returned (e.g. no limit will be applied).
func (*DBListRepo) MoveDown ¶
func (r *DBListRepo) MoveDown(item *ListItem) error
MoveDown will swop a ListItem with the ListItem directly below it, taking visibility and current matches into account.
func (*DBListRepo) MoveUp ¶
func (r *DBListRepo) MoveUp(item *ListItem) error
MoveUp will swop a ListItem with the ListItem directly above it, taking visibility and current matches into account.
func (*DBListRepo) Redo ¶
func (r *DBListRepo) Redo() (string, error)
func (*DBListRepo) Replay ¶
func (r *DBListRepo) Replay(partialWal []EventLog) error
Replay updates listItems based on the current state of the local WAL logs. It generates or updates the linked list which is attached to DBListRepo.Root
func (*DBListRepo) SaveListItemNote ¶ added in v0.22.0
func (r *DBListRepo) SaveListItemNote(key string, note []byte)
func (*DBListRepo) SetCollabPosition ¶
func (r *DBListRepo) SetCollabPosition(ev cursorMoveEvent) bool
func (*DBListRepo) Start ¶
func (r *DBListRepo) Start(client Client) error
Start begins push/pull for all WalFiles
func (*DBListRepo) TestPullLocal ¶ added in v0.25.0
func (r *DBListRepo) TestPullLocal(c chan namedWal) error
func (*DBListRepo) ToggleVisibility ¶
func (r *DBListRepo) ToggleVisibility(item *ListItem) (string, error)
ToggleVisibility will toggle an item to be visible or invisible
func (*DBListRepo) Undo ¶
func (r *DBListRepo) Undo() (string, error)
func (*DBListRepo) Update ¶
func (r *DBListRepo) Update(line string, item *ListItem) error
Update will update the line or note of an existing ListItem
func (*DBListRepo) UpdateNote ¶ added in v0.25.0
func (r *DBListRepo) UpdateNote(note []byte, item *ListItem) error
TODO rethink this interface
type DbEventLogger ¶
type DbEventLogger struct {
// contains filtered or unexported fields
}
DbEventLogger is used for in-mem undo/redo mechanism
func NewDbEventLogger ¶
func NewDbEventLogger() *DbEventLogger
NewDbEventLogger Returns a new instance of DbEventLogger
type EventLog ¶
type EventLogSchema4 ¶ added in v0.22.0
type EventLogSchema5 ¶ added in v0.22.0
type EventLogSchema6 ¶ added in v0.25.0
type FileWebTokenStore ¶
type FileWebTokenStore struct { User string `yaml:"user"` Refresh string `yaml:"refreshToken"` ID string `yaml:"idToken"` // contains filtered or unexported fields }
func NewFileWebTokenStore ¶
func NewFileWebTokenStore(root string) *FileWebTokenStore
func (*FileWebTokenStore) Email ¶ added in v0.22.0
func (wt *FileWebTokenStore) Email() string
func (*FileWebTokenStore) Flush ¶
func (wt *FileWebTokenStore) Flush()
func (*FileWebTokenStore) IDToken ¶
func (wt *FileWebTokenStore) IDToken() string
func (*FileWebTokenStore) RefreshToken ¶
func (wt *FileWebTokenStore) RefreshToken() string
func (*FileWebTokenStore) SetEmail ¶ added in v0.22.0
func (wt *FileWebTokenStore) SetEmail(s string)
TODO reconsider this interface...
func (*FileWebTokenStore) SetIDToken ¶
func (wt *FileWebTokenStore) SetIDToken(s string)
func (*FileWebTokenStore) SetRefreshToken ¶
func (wt *FileWebTokenStore) SetRefreshToken(s string)
type FinishWithPurgeError ¶ added in v0.23.0
type FinishWithPurgeError struct{}
func (FinishWithPurgeError) Error ¶ added in v0.23.0
func (e FinishWithPurgeError) Error() string
type FriendState ¶ added in v0.24.0
type FriendState int
const ( FriendNull FriendState = iota FriendPending FriendActive )
type InteractionEvent ¶ added in v0.22.0
type InteractionEvent struct { T InteractionEventType Key string R []rune }
InteractionEvent ...
type InteractionEventType ¶ added in v0.22.0
type InteractionEventType uint32
InteractionEventType ...
const ( KeyNull InteractionEventType = iota KeyEscape KeyEnter KeyDeleteItem KeyOpenNote KeyGotoStart KeyGotoEnd KeyVisibility KeyUndo KeyRedo KeyCopy KeyPaste KeyOpenURL KeyExport KeySelect KeyAddSearchGroup KeyBackspace KeyDelete KeyMoveItemUp KeyMoveItemDown KeyCursorDown KeyCursorUp KeyCursorRight KeyCursorLeft KeyRune SetText )
type LegacyListItem ¶ added in v0.25.0
type LineFriends ¶ added in v0.22.0
type LineFriendsSchema4 ¶ added in v0.22.0
type ListItem ¶
type ListItem struct { Note []byte // TODO make private IsHidden bool // contains filtered or unexported fields }
ListItem is a mergeable data structure which represents a single item in the main list. It maintains record of the last update lamport times
type LocalFileWalFile ¶
type LocalFileWalFile struct {
// contains filtered or unexported fields
}
func NewLocalFileWalFile ¶
func NewLocalFileWalFile(rootDir string) *LocalFileWalFile
func (*LocalFileWalFile) GetMatchingWals ¶
func (*LocalFileWalFile) GetRoot ¶
func (wf *LocalFileWalFile) GetRoot() string
func (*LocalFileWalFile) GetUUID ¶
func (wf *LocalFileWalFile) GetUUID() string
func (*LocalFileWalFile) GetWalBytes ¶
func (*LocalFileWalFile) Purge ¶
func (wf *LocalFileWalFile) Purge()
func (*LocalFileWalFile) RemoveWals ¶
func (wf *LocalFileWalFile) RemoveWals(ctx context.Context, fileNames []string) error
type LocalWalFile ¶
type LocalWalFile interface { Purge() WalFile }
type MatchPattern ¶ added in v0.22.0
type MatchPattern int
const ( FullMatchPattern MatchPattern = iota InverseMatchPattern FuzzyMatchPattern NoMatchPattern )
func GetMatchPattern ¶
func GetMatchPattern(sub []rune) (MatchPattern, int)
GetMatchPattern will return the MatchPattern of a given string, if any, plus the number of chars that can be omitted to leave only the relevant text
type RefreshKey ¶ added in v0.24.0
type WalFile ¶
type WalFile interface { GetUUID() string GetRoot() string GetMatchingWals(context.Context, string) ([]string, error) GetWalBytes(context.Context, io.Writer, string) error RemoveWals(context.Context, []string) error Flush(context.Context, *bytes.Buffer, string) error }
WalFile offers a generic interface into local or remote filesystems
type Web ¶
type Web struct {
// contains filtered or unexported fields
}
func NewWeb ¶
func NewWeb(webTokens WebTokenStore) *Web
type WebTokenStore ¶
type WebWalFile ¶
type WebWalFile struct {
// contains filtered or unexported fields
}
func (*WebWalFile) GetMatchingWals ¶
func (*WebWalFile) GetRoot ¶
func (wf *WebWalFile) GetRoot() string
func (*WebWalFile) GetUUID ¶
func (wf *WebWalFile) GetUUID() string
func (*WebWalFile) GetWalBytes ¶
func (*WebWalFile) RemoveWals ¶
func (wf *WebWalFile) RemoveWals(ctx context.Context, fileNames []string) error