file

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2021 License: BSD-3-Clause Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewLimitWriteCloser

func NewLimitWriteCloser(w io.WriteCloser, c int64) io.WriteCloser

NewLimitWriteCloser creates a new LimitWriteCloser.

func NopWriteCloser

func NopWriteCloser(w io.Writer) io.WriteCloser

NopWriteCloser returns a new io.WriteCloser with the given writer as io.Writer.

func SetLogger

func SetLogger(cmd *cobra.Command, verbosityString string) (logger logging.Logger, err error)

Types

type ApiStore

type ApiStore struct {
	Client *http.Client
	// contains filtered or unexported fields
}

ApiStore provies a storage.Putter that adds chunks to swarm through the HTTP chunk API.

func (*ApiStore) Get

func (a *ApiStore) Get(ctx context.Context, mode storage.ModeGet, address swarm.Address) (ch swarm.Chunk, err error)

Get implements storage.Getter.

func (*ApiStore) Put

func (a *ApiStore) Put(ctx context.Context, mode storage.ModePut, chs ...swarm.Chunk) (exist []bool, err error)

Put implements storage.Putter.

type FsStore

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

FsStore provides a storage.Putter that writes chunks directly to the filesystem. Each chunk is a separate file, where the hex address of the chunk is the file name.

func (*FsStore) Get

func (f *FsStore) Get(ctx context.Context, mode storage.ModeGet, address swarm.Address) (ch swarm.Chunk, err error)

Get implements storage.Getter.

func (*FsStore) Put

func (f *FsStore) Put(ctx context.Context, mode storage.ModePut, chs ...swarm.Chunk) (exist []bool, err error)

Put implements storage.Putter.

type LimitWriteCloser

type LimitWriteCloser struct {
	io.WriteCloser
	// contains filtered or unexported fields
}

LimitWriteCloser limits the output from the application.

func (*LimitWriteCloser) Write

func (l *LimitWriteCloser) Write(b []byte) (int, error)

Write implements io.Writer.

type PutGetter

type PutGetter interface {
	storage.Putter
	storage.Getter
}

PutGetter wraps both storage.Putter and storage.Getter interfaces

func NewApiStore

func NewApiStore(host string, port int, ssl bool) PutGetter

NewApiStore creates a new ApiStore.

func NewFsStore

func NewFsStore(path string) PutGetter

NewFsStore creates a new FsStore.

type TeeStore

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

TeeStore provides a storage.Putter that can put to multiple underlying storage.Putters.

func NewTeeStore

func NewTeeStore() *TeeStore

NewTeeStore creates a new TeeStore.

func (*TeeStore) Add

func (t *TeeStore) Add(putter storage.Putter)

Add adds a storage.Putter.

func (*TeeStore) Put

func (t *TeeStore) Put(ctx context.Context, mode storage.ModePut, chs ...swarm.Chunk) (exist []bool, err error)

Put implements storage.Putter.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳