storage

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

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 MessageReader

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

MessageReader lets user access message based on CID address

type MessageStorage

type MessageStorage interface {
	MessageReader
	MessageWriter
}

MessageStorage is responsible for accessing the messages based on CID

type MessageWriter

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

MessageWriter persists message with CID accessor

type ProtoMessageStorage

type ProtoMessageStorage struct {
	// contains filtered or unexported fields
}

func NewProtoMessageStorage

func NewProtoMessageStorage(contentStorage ContentStorage) *ProtoMessageStorage

func (*ProtoMessageStorage) Read

func (*ProtoMessageStorage) Write

func (p *ProtoMessageStorage) Write(ctx context.Context, message proto.Message) (cid.Cid, error)

type ProtoUnmarshallable

type ProtoUnmarshallable interface {
	Unmarshall(message proto.Message) error
}

ProtoUnmarshallable can be used to deserialize message data to proto structure

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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