Documentation
¶
Index ¶
- type Hooks
- type Service
- func (s *Service) Delete(ctx context.Context, key string) error
- func (s *Service) Get(ctx context.Context, key string) ([]byte, string, error)
- func (s *Service) Head(ctx context.Context, key string) (*objectstore.ObjectInfo, error)
- func (s *Service) List(ctx context.Context, prefix string) ([]*objectstore.ObjectInfo, error)
- func (s *Service) Put(ctx context.Context, key string, data []byte, opts *objectstore.PutOptions) (string, error)
- func (s *Service) Reset()
- func (s *Service) SetHooks(h Hooks)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Hooks ¶
type Hooks struct {
BeforeGet func(ctx context.Context, key string) error
BeforePut func(ctx context.Context, key string, data []byte, opts *objectstore.PutOptions) error
BeforeDelete func(ctx context.Context, key string) error
BeforeHead func(ctx context.Context, key string) error
BeforeList func(ctx context.Context, prefix string) error
}
Hooks lets tests inject errors for specific operations. Each hook runs before the corresponding Service method touches state. If a hook returns a non-nil error, that error is returned verbatim and no state changes. Nil hook fields are skipped.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service is an in-memory objectstore.Service implementation.
ETags are simulated with a monotonically-increasing counter per service instance: every successful Put yields a new ETag, so clients holding a stale ETag will fail IfMatch checks.
Hooks must be configured via SetHooks before any concurrent operations start; SetHooks does not synchronise with in-flight calls.
func (*Service) Head ¶
func (s *Service) Head(ctx context.Context, key string) (*objectstore.ObjectInfo, error)
func (*Service) List ¶
func (s *Service) List(ctx context.Context, prefix string) ([]*objectstore.ObjectInfo, error)
func (*Service) Put ¶
func (s *Service) Put( ctx context.Context, key string, data []byte, opts *objectstore.PutOptions, ) (string, error)
Click to show internal directories.
Click to hide internal directories.