storagekit

package
v0.6.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 21, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package storagekit holds the few helpers every storage.Store implementation shares, so the adapters (storage/local, storage/s3 and storagetest's memory store) cannot drift apart on them. It is internal: an adapter written elsewhere writes its own, and the conformance suite holds it to the same contract.

Index

Constants

View Source
const KeyAttempts = 3

KeyAttempts is how many generated keys a write tries before it reports a collision as storage.ErrExists.

Variables

This section is empty.

Functions

func Check

func Check(ctx context.Context, key string) error

Check is the preamble every call that names a key shares: the context, then the key's form.

func Range

func Range(size, offset, length int64) (end int64, err error)

Range resolves an Open request against an object of size bytes: it returns the end of the range starting at offset. A negative length, or one that reaches or exceeds the remaining bytes (math.MaxInt64 included), reads to the end. An offset that is negative or beyond the end is storage.ErrInvalidRange. It never overflows, whatever length is.

Types

type ContextReader

type ContextReader struct {
	Ctx context.Context
	R   io.Reader
}

ContextReader stops a copy as soon as Ctx is done.

func (*ContextReader) Read

func (c *ContextReader) Read(p []byte) (int, error)

Read implements io.Reader.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL