go-gun/gun/storage.go

28 lines
649 B
Go
Raw Normal View History

2019-02-20 20:54:46 +00:00
package gun
2019-02-22 06:46:19 +00:00
import (
"context"
"errors"
"sync"
)
var ErrStorageNotFound = errors.New("Not found")
2019-02-20 20:54:46 +00:00
type Storage interface {
2019-02-22 09:23:14 +00:00
Get(ctx context.Context, parentSoul, field string) (*ValueWithState, error)
Put(ctx context.Context, parentSoul, field string, val *ValueWithState) (bool, error)
2019-02-22 06:46:19 +00:00
// Tracking(ctx context.Context, id string) (bool, error)
2019-02-20 20:54:46 +00:00
}
type StorageInMem struct {
2019-02-22 06:46:19 +00:00
values sync.Map
}
2019-02-22 09:23:14 +00:00
func (s *StorageInMem) Get(ctx context.Context, parentSoul, field string) (*ValueWithState, error) {
2019-02-22 06:46:19 +00:00
panic("TODO")
}
2019-02-22 09:23:14 +00:00
func (s *StorageInMem) Put(ctx context.Context, parentSoul, field string, val *ValueWithState) (bool, error) {
2019-02-22 06:46:19 +00:00
panic("TODO")
2019-02-20 20:54:46 +00:00
}