storage

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2020 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var NotFoundError = errors.New("NotFound")

Functions

func NotFound

func NotFound(e error) bool

Types

type DB

type DB struct {
	Sessions         map[string]*types.Session         `json:"sessions"`
	Instances        map[string]*types.Instance        `json:"instances"`
	Clients          map[string]*types.Client          `json:"clients"`
	WindowsInstances map[string]*types.WindowsInstance `json:"windows_instances"`
	LoginRequests    map[string]*types.LoginRequest    `json:"login_requests"`
	Users            map[string]*types.User            `json:"user"`
	Playgrounds      map[string]*types.Playground      `json:"playgrounds"`

	WindowsInstancesBySessionId map[string][]string `json:"windows_instances_by_session_id"`
	InstancesBySessionId        map[string][]string `json:"instances_by_session_id"`
	ClientsBySessionId          map[string][]string `json:"clients_by_session_id"`
	UsersByProvider             map[string]string   `json:"users_by_providers"`
}

type Mock

type Mock struct {
	mock.Mock
}

func (*Mock) ClientCount

func (m *Mock) ClientCount() (int, error)

func (*Mock) ClientDelete

func (m *Mock) ClientDelete(id string) error

func (*Mock) ClientFindBySessionId

func (m *Mock) ClientFindBySessionId(sessionId string) ([]*types.Client, error)

func (*Mock) ClientGet

func (m *Mock) ClientGet(id string) (*types.Client, error)

func (*Mock) ClientPut

func (m *Mock) ClientPut(client *types.Client) error

func (*Mock) InstanceCount

func (m *Mock) InstanceCount() (int, error)

func (*Mock) InstanceDelete

func (m *Mock) InstanceDelete(name string) error

func (*Mock) InstanceFindBySessionId

func (m *Mock) InstanceFindBySessionId(sessionId string) ([]*types.Instance, error)

func (*Mock) InstanceGet

func (m *Mock) InstanceGet(name string) (*types.Instance, error)

func (*Mock) InstancePut

func (m *Mock) InstancePut(instance *types.Instance) error

func (*Mock) LoginRequestDelete

func (m *Mock) LoginRequestDelete(id string) error

func (*Mock) LoginRequestGet

func (m *Mock) LoginRequestGet(id string) (*types.LoginRequest, error)

func (*Mock) LoginRequestPut

func (m *Mock) LoginRequestPut(loginRequest *types.LoginRequest) error

func (*Mock) PlaygroundGet

func (m *Mock) PlaygroundGet(id string) (*types.Playground, error)

func (*Mock) PlaygroundGetAll

func (m *Mock) PlaygroundGetAll() ([]*types.Playground, error)

func (*Mock) PlaygroundPut

func (m *Mock) PlaygroundPut(playground *types.Playground) error

func (*Mock) SessionCount

func (m *Mock) SessionCount() (int, error)

func (*Mock) SessionDelete

func (m *Mock) SessionDelete(id string) error

func (*Mock) SessionGet

func (m *Mock) SessionGet(id string) (*types.Session, error)

func (*Mock) SessionGetAll

func (m *Mock) SessionGetAll() ([]*types.Session, error)

func (*Mock) SessionPut

func (m *Mock) SessionPut(session *types.Session) error

func (*Mock) UserFindByProvider

func (m *Mock) UserFindByProvider(providerName, providerUserId string) (*types.User, error)

func (*Mock) UserGet

func (m *Mock) UserGet(id string) (*types.User, error)

func (*Mock) UserPut

func (m *Mock) UserPut(user *types.User) error

func (*Mock) WindowsInstanceDelete

func (m *Mock) WindowsInstanceDelete(id string) error

func (*Mock) WindowsInstanceGetAll

func (m *Mock) WindowsInstanceGetAll() ([]*types.WindowsInstance, error)

func (*Mock) WindowsInstancePut

func (m *Mock) WindowsInstancePut(instance *types.WindowsInstance) error

type StorageApi

type StorageApi interface {
	SessionGet(id string) (*types.Session, error)
	SessionGetAll() ([]*types.Session, error)
	SessionPut(session *types.Session) error
	SessionDelete(id string) error
	SessionCount() (int, error)

	InstanceGet(name string) (*types.Instance, error)
	InstancePut(instance *types.Instance) error
	InstanceDelete(name string) error
	InstanceCount() (int, error)
	InstanceFindBySessionId(sessionId string) ([]*types.Instance, error)

	WindowsInstanceGetAll() ([]*types.WindowsInstance, error)
	WindowsInstancePut(instance *types.WindowsInstance) error
	WindowsInstanceDelete(id string) error

	ClientGet(id string) (*types.Client, error)
	ClientPut(client *types.Client) error
	ClientDelete(id string) error
	ClientCount() (int, error)
	ClientFindBySessionId(sessionId string) ([]*types.Client, error)

	LoginRequestPut(loginRequest *types.LoginRequest) error
	LoginRequestGet(id string) (*types.LoginRequest, error)
	LoginRequestDelete(id string) error

	UserFindByProvider(providerName, providerUserId string) (*types.User, error)
	UserPut(user *types.User) error
	UserGet(id string) (*types.User, error)

	PlaygroundPut(playground *types.Playground) error
	PlaygroundGet(id string) (*types.Playground, error)
	PlaygroundGetAll() ([]*types.Playground, error)
}

func NewFileStorage

func NewFileStorage(path string) (StorageApi, error)

Jump to

Keyboard shortcuts

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