Documentation
¶
Index ¶
- Variables
- func Authenticate(wt WebTokenStore, args map[string]string) 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) GetCollabPositions() map[string][]string
- func (r *DBListRepo) GetListItem(key string) (ListItem, bool)
- func (r *DBListRepo) GetListItemNote(key string) []byte
- 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) ToggleVisibility(item *ListItem) (string, error)
- func (r *DBListRepo) Undo() (string, error)
- func (r *DBListRepo) Update(line string, note []byte, item *ListItem) error
- type DbEventLogger
- type EventLog
- type EventLogSchema4
- type EventLogSchema5
- 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 InteractionEvent
- type InteractionEventType
- 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 WalFile
- type Web
- type WebRemote
- type WebTokenStore
- type WebWalFile
- func (wf *WebWalFile) Flush(ctx context.Context, b *bytes.Buffer, tempUUID 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 ¶
This section is empty.
Variables ¶
var EmailRegex = regexp.MustCompile("[a-zA-Z0-9.!#$%&'*+\\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*")
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 {
Root *ListItem
// TODO better naming convention
LocalWalFile LocalWalFile
// contains filtered or unexported fields
}
DBListRepo is an implementation of the ListRepo interface
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) GetCollabPositions ¶
func (r *DBListRepo) GetCollabPositions() map[string][]string
GetCollabPositions returns a map of listItemKeys against all collaborators currently on that listItem
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) 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) 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)
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 EventLogSchema4 ¶ added in v0.22.0
type EventLogSchema5 ¶ added in v0.22.0
type EventType ¶
type EventType uint16
const ( NullEvent EventType = iota AddEvent UpdateEvent MoveUpEvent MoveDownEvent ShowEvent HideEvent DeleteEvent )
Ordering of these enums are VERY IMPORTANT as they're used for comparisons when resolving WAL merge conflicts (although there has to be nanosecond level collisions in order for this to be relevant)
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 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 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 represents a single item in the returned list, based on the Match() input
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 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
func (*Web) CallWithReAuth ¶
CallWithReAuth accepts a pre-built request, attempts to call it, and if it fails authorisation due to an expired IDToken, will reauth, and then retry the original function.
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