Documentation
¶
Overview ¶
Package arkmem implements ark.Backend in memory.
Objects live in a map keyed by "<namespace>/<name>", where the namespace is ark.HandleType.String(). Nothing is persisted; a Backend starts empty and is discarded with its process. It exists for unit tests and examples that need a repository without a filesystem.
Index ¶
- type Backend
- func (b *Backend) Close() error
- func (b *Backend) Delete(ctx context.Context, h ark.Handle) error
- func (b *Backend) Exists(ctx context.Context, h ark.Handle) (bool, error)
- func (b *Backend) Get(ctx context.Context, h ark.Handle) (io.ReadCloser, error)
- func (b *Backend) List(ctx context.Context, t ark.HandleType, fn func(ark.BlobInfo) error) error
- func (b *Backend) Put(ctx context.Context, h ark.Handle, r io.Reader) error
- func (b *Backend) Stat(ctx context.Context, h ark.Handle) (ark.BlobInfo, error)
- func (b *Backend) Sync(ctx context.Context) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Backend ¶
type Backend struct {
// contains filtered or unexported fields
}
Backend implements ark.Backend backed by a map. It is safe for concurrent use; the zero value is not, use New.
func (*Backend) Close ¶
Close drops every stored object. The backend stays usable and is empty afterwards.
func (*Backend) Delete ¶
Delete removes the object identified by h. A missing object is not an error.
func (*Backend) List ¶
List calls fn for every object in the namespace of t. An empty namespace is not an error.
func (*Backend) Put ¶
Put reads r fully and stores it under h, replacing any existing object. The store is only updated once the read succeeded, so a failed Put leaves the previous object in place and no reader observes a partial one.