21 lines
273 B
Go
21 lines
273 B
Go
package trade
|
|
|
|
type Store interface {
|
|
Get(string) any
|
|
Set(string, any)
|
|
Del(string)
|
|
}
|
|
|
|
type KV[t any] struct {
|
|
local map[string]t
|
|
store Store
|
|
peers []Server
|
|
}
|
|
|
|
func NewKV[t any](s Store) KV[t] {
|
|
res := KV[t]{
|
|
local: make(map[string]t),
|
|
store: s,
|
|
}
|
|
return res
|
|
}
|