store

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2020 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoActivity = errors.New("no activity exist currently")

Functions

This section is empty.

Types

type Directory

type Directory struct {
	Id        string
	Directory string
}

type InHeap

type InHeap struct {
	Id       string
	Language string
	Branch   string
	FileName string
	Project  string
	Git      string
}

type Meta

type Meta struct {
	SessionId        string
	KeypressCount    uint64
	Editors          []string
	HeapAddedToQueue bool
	FirstActivity    time.Time
	LastActivity     time.Time
}

type OutHeap

type OutHeap struct {
	Id        string
	Languages []string
	Files     []string
	Project   string
	Git       string
	Branch    string
}

type Store

type Store struct {
	NotifyListenToDirectory chan string
	// contains filtered or unexported fields
}

func New

func New() (*Store, error)

func (*Store) AddDirectory

func (s *Store) AddDirectory(directory string) error

func (*Store) AddHeap

func (s *Store) AddHeap(heap InHeap) error

func (*Store) AddToQueue

func (s *Store) AddToQueue(record []byte) error

Add a json in byte format to queue

func (*Store) AuthorizationFlow

func (s *Store) AuthorizationFlow() (string, string, error)

Get values for the authorization flow

func (*Store) AuthorizationToken

func (s *Store) AuthorizationToken() string

Get the authorization token from store

func (*Store) Close

func (s *Store) Close()

func (*Store) DeleteDirectory

func (s *Store) DeleteDirectory(directory string) error

func (*Store) DeleteHeap

func (s *Store) DeleteHeap(id string) error

func (*Store) Directories

func (s *Store) Directories() ([]Directory, error)

func (*Store) HeapById

func (s *Store) HeapById(id string) (OutHeap, error)

func (*Store) Heaps

func (s *Store) Heaps() ([]string, error)

func (*Store) Meta

func (s *Store) Meta() (Meta, error)

func (*Store) MetaTypingActivity

func (s *Store) MetaTypingActivity(editor string) error

This function will react on keypress and update the meta state

func (*Store) NewSession

func (s *Store) NewSession() error

Add a new session, this happens when the meta and heaps should all be reset into a new session.

func (*Store) NextInQueue

func (s *Store) NextInQueue(Callback func([]byte) error) error

Send in a callback that receives payload, if no error occur in callback delete payload from queue

func (*Store) NotifyCurrentDirectories added in v0.1.1

func (s *Store) NotifyCurrentDirectories() error

Function will notify on channel all directories that exist already

func (*Store) SaveAuthorizationFlow

func (s *Store) SaveAuthorizationFlow(id, link string) error

Save the authorization flow

func (*Store) SentToQueue

func (s *Store) SentToQueue() error

Update heap_added_to_queue status, this gets called when heap has been added to queue and it shouldn't happen again until next activity. It also reset first_activity

func (*Store) SetAuthorizationToken

func (s *Store) SetAuthorizationToken(apiKey string) error

Set authorization token in store

func (*Store) SetUserSignatureName

func (s *Store) SetUserSignatureName(userSignatureName string) error

Set the signature username in store

func (*Store) UserSignatureName

func (s *Store) UserSignatureName() string

Get the user signature name from store

Jump to

Keyboard shortcuts

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