-
Notifications
You must be signed in to change notification settings - Fork 703
/
storage.go
49 lines (38 loc) · 1.45 KB
/
storage.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
package storage
import (
"errors"
"github.com/play-with-docker/play-with-docker/pwd/types"
)
var NotFoundError = errors.New("NotFound")
func NotFound(e error) bool {
return e == NotFoundError
}
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)
}