storage

package
v0.0.0-...-b67c493 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2023 License: BSD-3-Clause Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateRandomId

func GenerateRandomId() (string, error)

Types

type Data

type Data struct {
	Data     []byte
	PassHash []byte
	Attach   bool
}

type DataError

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

type Disk

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

func (*Disk) Delete

func (s *Disk) Delete(id string) error

func (*Disk) FormPath

func (s *Disk) FormPath(id string) string

func (*Disk) Get

func (s *Disk) Get(id string, passHash string) (Data, error)

func (*Disk) Post

func (s *Disk) Post(data Data, expires int64) (string, error)

type IdGenerationError

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

type IoError

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

type Memory

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

func (*Memory) Delete

func (m *Memory) Delete(id string) error

func (*Memory) Get

func (m *Memory) Get(id string, passHash string) (Data, error)

func (*Memory) Post

func (m *Memory) Post(data Data, expires int64) (string, error)

type Network

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

func (*Network) Delete

func (n *Network) Delete(id string) error

func (*Network) Get

func (n *Network) Get(id string, passHash string) (Data, error)

func (*Network) Post

func (n *Network) Post(data Data, expires int64) (string, error)

type NetworkError

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

type NotFound

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

type Remote

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

func (*Remote) Delete

func (s *Remote) Delete(id string) error

func (*Remote) Get

func (s *Remote) Get(id string, passHash string) (Data, error)

func (*Remote) Post

func (s *Remote) Post(data Data, expires int64) (string, error)

type Storage

type Storage interface {
	Post(data Data, expires int64) (string, error)
	Get(id string, passHash string) (Data, error)
	Delete(id string) error
}

func OpenDiskStorageFromEnv

func OpenDiskStorageFromEnv() (Storage, error)

func OpenMemoryStorage

func OpenMemoryStorage() Storage

func OpenNetworkStorageFromEnv

func OpenNetworkStorageFromEnv() (Storage, error)

func OpenRemoteStorage

func OpenRemoteStorage(apiUrl string) (Storage, error)

Jump to

Keyboard shortcuts

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