-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstore.go
More file actions
120 lines (99 loc) · 3.39 KB
/
store.go
File metadata and controls
120 lines (99 loc) · 3.39 KB
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
// Package template contains the Example store implementation.
// This package is a template only.
package template
import (
"context"
"github.com/kvtools/valkeyrie"
"github.com/kvtools/valkeyrie/store"
)
// StoreName the name of the store.
// TODO implement me.
const StoreName = "example"
// registers Example to Valkeyrie.
func init() {
valkeyrie.Register(StoreName, newStore)
}
// Config the Example configuration.
// TODO implement me.
type Config struct {
Username string
Password string
}
func newStore(ctx context.Context, endpoints []string, options valkeyrie.Config) (store.Store, error) {
cfg, ok := options.(*Config)
if !ok && options != nil {
return nil, &store.InvalidConfigurationError{Store: StoreName, Config: options}
}
return New(ctx, endpoints, cfg)
}
// Store implements the store.Store interface.
// TODO implement me.
type Store struct{}
// New creates a new Example client.
// TODO implement me.
func New(ctx context.Context, endpoints []string, options *Config) (*Store, error) {
return &Store{}, nil
}
// Put a value at the specified key.
func (s Store) Put(ctx context.Context, key string, value []byte, opts *store.WriteOptions) error {
// TODO implement me
panic("implement me")
}
// Get a value given its key.
func (s Store) Get(ctx context.Context, key string, opts *store.ReadOptions) (*store.KVPair, error) {
// TODO implement me
panic("implement me")
}
// Delete the value at the specified key.
func (s Store) Delete(ctx context.Context, key string) error {
// TODO implement me
panic("implement me")
}
// Exists Verify if a Key exists in the store.
func (s Store) Exists(ctx context.Context, key string, opts *store.ReadOptions) (bool, error) {
// TODO implement me
panic("implement me")
}
// Watch for changes on a key.
func (s Store) Watch(ctx context.Context, key string, opts *store.ReadOptions) (<-chan *store.KVPair, error) {
// TODO implement me
panic("implement me")
}
// WatchTree watches for changes on child nodes under a given directory.
func (s Store) WatchTree(ctx context.Context, directory string, opts *store.ReadOptions) (<-chan []*store.KVPair, error) {
// TODO implement me
panic("implement me")
}
// NewLock creates a lock for a given key.
// The returned Locker is not held and must be acquired with `.Lock`.
// The Value is optional.
func (s Store) NewLock(ctx context.Context, key string, opts *store.LockOptions) (store.Locker, error) {
// TODO implement me
panic("implement me")
}
// List the content of a given prefix.
func (s Store) List(ctx context.Context, directory string, opts *store.ReadOptions) ([]*store.KVPair, error) {
// TODO implement me
panic("implement me")
}
// DeleteTree deletes a range of keys under a given directory.
func (s Store) DeleteTree(ctx context.Context, directory string) error {
// TODO implement me
panic("implement me")
}
// AtomicPut Atomic CAS operation on a single value.
// Pass previous = nil to create a new key.
func (s Store) AtomicPut(ctx context.Context, key string, value []byte, previous *store.KVPair, opts *store.WriteOptions) (bool, *store.KVPair, error) {
// TODO implement me
panic("implement me")
}
// AtomicDelete Atomic delete of a single value.
func (s Store) AtomicDelete(ctx context.Context, key string, previous *store.KVPair) (bool, error) {
// TODO implement me
panic("implement me")
}
// Close the store connection.
func (s Store) Close() error {
// TODO implement me
panic("implement me")
}