storage

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2019 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TYPE_FS   = "fs"
	FS_VOLUME = "FS_VOLUME_"
)
View Source
const (
	TYPE_SHA   = "sha"
	SHA_VOLUME = "SHA_VOLUME_"
)
View Source
const (
	TYPE  = "storage"
	PAGE  = "page"
	UNZIP = "unzip"
)

Variables

This section is empty.

Functions

func Close

func Close()

func Init

func Init(name string, cfg *common.Jason, router *mux.Router) error

func Put

func Put(name string, storage *Storage)

Types

type ErrInvalidUID

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

func (*ErrInvalidUID) Error

func (e *ErrInvalidUID) Error() string

type ErrInvalidVolumeName

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

func (*ErrInvalidVolumeName) Error

func (e *ErrInvalidVolumeName) Error() string

type ErrNoVolumesDefined

type ErrNoVolumesDefined struct {
}

func (*ErrNoVolumesDefined) Error

func (e *ErrNoVolumesDefined) Error() string

type ErrObjectAlreadyExists

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

func (*ErrObjectAlreadyExists) Error

func (e *ErrObjectAlreadyExists) Error() string

type ErrObjectNotFound

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

func (*ErrObjectNotFound) Error

func (e *ErrObjectNotFound) Error() string

type ErrVolumePathNotFound

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

func (*ErrVolumePathNotFound) Error

func (e *ErrVolumePathNotFound) Error() string

type Fs

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

func NewFs

func NewFs() (*Fs, error)

func (*Fs) AddVolume

func (fs *Fs) AddVolume(v *FsVolume)

func (*Fs) CurrentVersion

func (fs *Fs) CurrentVersion(uid *FsUID) (int, error)

func (*Fs) Delete

func (fs *Fs) Delete(suid string, options *Options) error

func (*Fs) Init

func (fs *Fs) Init(cfg *common.Jason) error

func (*Fs) Load

func (fs *Fs) Load(suid string, dest io.Writer, options *Options) (*[]byte, int64, error)

func (*Fs) Rebuild

func (fs *Fs) Rebuild() (int, error)

func (*Fs) RemoveVolume

func (fs *Fs) RemoveVolume(v *FsVolume)

func (*Fs) Start

func (fs *Fs) Start() error

func (*Fs) Stop

func (fs *Fs) Stop() error

func (*Fs) Store

func (fs *Fs) Store(suid string, source io.Reader, options *Options) (string, *[]byte, error)

func (*Fs) Volume

func (fs *Fs) Volume(n string) *FsVolume

func (*Fs) Volumes

func (fs *Fs) Volumes() []string

type FsUID

type FsUID struct {
	Path string
}

func NewFsUID

func NewFsUID(path string) *FsUID

func ParseFsUID

func ParseFsUID(s string) (*FsUID, error)

func (*FsUID) String

func (uid *FsUID) String() string

type FsVolume

type FsVolume struct {
	Name string
	Path string
}

func NewFsVolume

func NewFsVolume(name string, path string) (*FsVolume, error)

type Options

type Options struct {
	VolumeName string
}

type Sha

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

func NewSha

func NewSha() (*Sha, error)

func (*Sha) AddVolume

func (sha *Sha) AddVolume(v *ShaVolume)

func (*Sha) CurrentVersion

func (sha *Sha) CurrentVersion(uid *ShaUID) (int, error)

func (*Sha) Delete

func (sha *Sha) Delete(suid string, options *Options) error

func (*Sha) Init

func (sha *Sha) Init(cfg *common.Jason) error

func (*Sha) Load

func (sha *Sha) Load(suid string, dest io.Writer, options *Options) (*[]byte, int64, error)

func (*Sha) Rebuild

func (sha *Sha) Rebuild() (int, error)

func (*Sha) RemoveVolume

func (sha *Sha) RemoveVolume(v *ShaVolume)

func (*Sha) Start

func (sha *Sha) Start() error

func (*Sha) Stop

func (sha *Sha) Stop() error

func (*Sha) Store

func (sha *Sha) Store(suid string, source io.Reader, options *Options) (string, *[]byte, error)

func (*Sha) Volume

func (sha *Sha) Volume(n string) *ShaVolume

func (*Sha) Volumes

func (sha *Sha) Volumes() []string

type ShaUID

type ShaUID struct {
	Id      int
	Version int
	Object  string
}

func NewShaUID

func NewShaUID(id int, version int, object string) *ShaUID

func ParseShaUID

func ParseShaUID(s string) (*ShaUID, error)

func (*ShaUID) String

func (uid *ShaUID) String() string

type ShaVolume

type ShaVolume struct {
	Name string
	Path string
	Flat bool
	Zip  bool
}

func NewShaVolume

func NewShaVolume(name string, path string, flat bool, zip bool) (*ShaVolume, error)

type Storage

type Storage interface {
	Init(*common.Jason) error
	Start() error
	Stop() error
	Rebuild() (int, error)
	Store(string, io.Reader, *Options) (string, *[]byte, error)
	Load(string, io.Writer, *Options) (*[]byte, int64, error)
	Delete(string, *Options) error
}

func Get

func Get(name string) *Storage

Jump to

Keyboard shortcuts

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