Documentation
¶
Overview ¶
Package chunked provides a mechanism to read and write chunked data files.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrNotFound = errors.New("not found")
ErrNotFound indicates that the specified content is not available.
Functions ¶
This section is empty.
Types ¶
type Chunk ¶
type Chunk interface {
ChunkID() string
Encode(out *gblob.PackedEncoder) error
Decode(in *gblob.PackedDecoder) error
}
type ChunkConsumer ¶
type ChunkConsumer interface {
AddChunk(chunk Chunk)
}
type ChunkHolder ¶
type ChunkHolder struct {
Items []Chunk
}
func (*ChunkHolder) AddChunk ¶
func (h *ChunkHolder) AddChunk(chunk Chunk)
func (ChunkHolder) Chunks ¶
func (h ChunkHolder) Chunks() []Chunk
type ChunkProvider ¶
type ChunkProvider interface {
Chunks() []Chunk
}
type RawData ¶
type RawData []byte
func (RawData) DecodePacked ¶
func (c RawData) DecodePacked(reader gblob.TypedReader) error
func (RawData) EncodePacked ¶
func (c RawData) EncodePacked(writer gblob.TypedWriter) error
type Storage ¶
type Storage interface {
// List returns all available assets.
List() ([]string, error)
// Open opens a reader for the data of the specified asset.
Open(path string) (io.ReadCloser, error)
// Create opens a writer for the data of the specified asset.
Create(path string) (io.WriteCloser, error)
// Delete removes the specified asset.
Delete(path string) error
}
Storage represents a storage interface for assets.
func NewFileStorage ¶
NewFileStorage creates a new storage that uses the file system.
func NewMemoryStorage ¶
func NewMemoryStorage() Storage
NewMemoryStorage creates a new storage that uses memory.
func NewWebStorage ¶
NewWebStorage creates a new storage that uses HTTP requests.
type ValueChunk ¶
func FromValue ¶
func FromValue[T any](id string, value T) *ValueChunk[T]
func (*ValueChunk[T]) ChunkID ¶
func (c *ValueChunk[T]) ChunkID() string
func (*ValueChunk[T]) Decode ¶
func (c *ValueChunk[T]) Decode(in *gblob.PackedDecoder) error
func (*ValueChunk[T]) Encode ¶
func (c *ValueChunk[T]) Encode(out *gblob.PackedEncoder) error
Click to show internal directories.
Click to hide internal directories.