storage

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package storage defines interfaces for content storage, message storage and codecs.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFound = errors.New("message was not found")
	ErrTimeout  = errors.New("timeout when accessing message")
	ErrInternal = errors.New("internal error")
)

Functions

This section is empty.

Types

type Codec added in v1.1.1

type Codec interface {
	Encoder
	Decoder
}

type ContentReader

type ContentReader interface {
	Read(ctx context.Context, cid cid.Cid) ([]byte, error)
}

ContentReader is responsible for fetching content based on it's CID.

type ContentStorage

type ContentStorage interface {
	ContentReader
	ContentWriter
}

ContentStorage allows its user to access content based on CID.

type ContentWriter

type ContentWriter interface {
	Write(ctx context.Context, content []byte, cid cid.Cid) error
}

ContentWriter writes given content with assigned CID

type Decoder added in v1.1.1

type Decoder interface {
	Decode(message RawMessage) ProtoDecodable
}

type Encoder added in v1.1.1

type Encoder interface {
	Encode(message proto.Message) (RawMessage, error)
}

Encoder

type MessageReader

type MessageReader interface {
	Read(ctx context.Context, cid cid.Cid) (ProtoDecodable, error)
}

type MessageStorage

type MessageStorage interface {
	MessageReader
	MessageWriter
}

type MessageWriter

type MessageWriter interface {
	Write(ctx context.Context, message proto.Message) (cid.Cid, error)
}

type ProtoDecodable added in v1.1.1

type ProtoDecodable interface {
	Decode(message proto.Message) error
}

ProtoDecodable can be used to deserialize message data to proto structure todo: refactor this to just passing generic type when go 1.18 is out

type RawMessage added in v1.1.1

type RawMessage []byte

Directories

Path Synopsis
content
localfs
Package localfs implements a content storage based on local file system.
Package localfs implements a content storage based on local file system.
memory
Package memory defines an in-memory content storage.
Package memory defines an in-memory content storage.
Package messagestorage defines a storage wrapper for handling PDCL messages.
Package messagestorage defines a storage wrapper for handling PDCL messages.
ipfs
Package ipfs defines a storage based on InterPlanetary File System.
Package ipfs defines a storage based on InterPlanetary File System.
Package pbcoded provides codecs for (de)serializing messages.
Package pbcoded provides codecs for (de)serializing messages.

Jump to

Keyboard shortcuts

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