Documentation ¶
Index ¶
- type AbstractFuture
- type Future
- type InitializeableFuture
- type Storage
- func (s *Storage) AddFuture(fut AbstractFuture)
- func (s *Storage) Allocate(ctx context.Context, storage core.ResourceDB) error
- func (s *Storage) AssignResource(fut AbstractFuture, res *core.Resource, saved bool)
- func (s *Storage) Encode(codec codec.Codec[any, []byte]) error
- func (s *Storage) GetResource(fut AbstractFuture) *core.Resource
- func (s *Storage) HasFuture(fut AbstractFuture) bool
- func (s *Storage) Rollback(ctx context.Context, storage core.ResourceDB) error
- func (s *Storage) Save(ctx context.Context, storage core.ResourceDB) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AbstractFuture ¶
type AbstractFuture interface { IsFilled() bool Encode(codec codec.Codec[any, []byte]) ([]byte, error) // contains filtered or unexported methods }
AbstractFuture can hold a future without caring about it's type
type Future ¶
type Future[T any] struct { // contains filtered or unexported fields }
func (Future[T]) EmptyValue ¶
func (f Future[T]) EmptyValue() T
func (*Future[T]) Initialize ¶
func (f *Future[T]) Initialize()
type InitializeableFuture ¶
type InitializeableFuture interface {
Initialize()
}
type Storage ¶
type Storage struct {
// contains filtered or unexported fields
}
Storage manages future-resource_db mapping. It is not thread safe
func NewStorage ¶
func NewStorage() Storage
func (*Storage) AddFuture ¶
func (s *Storage) AddFuture(fut AbstractFuture)
func (*Storage) Allocate ¶
Allocate ids for resources without them, empty resources are assigned to futures without them
func (*Storage) AssignResource ¶
func (s *Storage) AssignResource(fut AbstractFuture, res *core.Resource, saved bool)
func (*Storage) Encode ¶
Encode all filled futures. It will create resources, or fill Data field for existing ones. Not filled futures and resources with Data are skipped.
func (*Storage) GetResource ¶
func (s *Storage) GetResource(fut AbstractFuture) *core.Resource
func (*Storage) HasFuture ¶
func (s *Storage) HasFuture(fut AbstractFuture) bool
Click to show internal directories.
Click to hide internal directories.