triparclient

package module
v0.0.0-...-688ad29 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2023 License: MIT Imports: 17 Imported by: 0

README

go-triparclient

Go HPE 3PAR Object Access REST API client.

GoDoc

Beware

Only supports a subset of the Object Access API. Feel free to send in pull requests extending this. ;)

Install

go get github.com/koofr/go-triparclient

Testing

go test

Coverage:

go test --coverprofile=go-triparclient.coverprofile && go tool cover -html=go-triparclient.coverprofile

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFound      = errors.New("not found")
	ErrNotAFile      = errors.New("not a file")
	ErrAlreadyExists = errors.New("already exists")
	ErrBadRange      = errors.New("bad range")
	ErrOther         = errors.New("unknown error")
)

Functions

func UnmarshalTriparError

func UnmarshalTriparError(r *http.Response) (err error)

func UnmarshalTriparResponse

func UnmarshalTriparResponse(r *http.Response, i interface{}) error

Types

type BufferPool

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

func NewBufferPool

func NewBufferPool(capacity int, bufferSize int64) *BufferPool

func (*BufferPool) Get

func (bp *BufferPool) Get() []byte

func (*BufferPool) Put

func (bp *BufferPool) Put(buffer []byte)

type BufferPoolIface

type BufferPoolIface interface {
	Get() []byte
	Put(buffer []byte)
}

type Entries

type Entries struct {
	Entries []Entry `json:"entries"`
}

type Entry

type Entry struct {
	Name string `json:"name"`
}

type Error

type Error struct {
	Code int    `json:"error_code"`
	LMsg string `json:"long_message"`
	SMsg string `json:"short_message"`
}

func UnmarshalError

func UnmarshalError(data []byte) (*Error, error)

func (*Error) Error

func (e *Error) Error() string

type PutPiece

type PutPiece struct {
	Buffer []byte
	Read   int
	Err    error
}

type Stat

type Stat struct {
	Path   string `json:"path"`
	Status Status `json:"status"`
}

func (Stat) IsDir

func (s Stat) IsDir() bool

type Status

type Status struct {
	Atime   float64 `json:"atime"`
	Blksize int64   `json:"blksize"`
	Blocks  int64   `json:"blocks"`
	Ctime   float64 `json:"ctime"`
	Dev     int32   `json:"dev"`
	Gid     int32   `json:"gid"`
	//	Ino     int64   `json:"ino"`
	Mode  int32   `json:"mode"`
	Mtime float64 `json:"mtime"`
	Nlink int32   `json:"nlink"`
	Rdev  int32   `json:"rdev"`
	Size  int64   `json:"size"`
	Uid   int32   `json:"uid"`
}

type TriparClient

type TriparClient struct {
	HTTPClient *httpclient.HTTPClient
	// contains filtered or unexported fields
}

func NewTriparClient

func NewTriparClient(
	endpoint string,
	user string,
	pass string,
	share string,
	bp BufferPoolIface,
	getChunkSize int64,
) (tp *TriparClient, err error)

func (*TriparClient) CopyObject

func (tp *TriparClient) CopyObject(ctx context.Context, path string, nupath string) (err error)

func (*TriparClient) CreateDirectories

func (tp *TriparClient) CreateDirectories(ctx context.Context, path string) (err error)

func (*TriparClient) CreateDirectory

func (tp *TriparClient) CreateDirectory(ctx context.Context, path string) (err error)

func (*TriparClient) DeleteDirectory

func (tp *TriparClient) DeleteDirectory(ctx context.Context, path string) (err error)

func (*TriparClient) DeleteObject

func (tp *TriparClient) DeleteObject(ctx context.Context, path string) (err error)

func (*TriparClient) Fsync

func (tp *TriparClient) Fsync(ctx context.Context, path string) (err error)

func (*TriparClient) GetObject

func (tp *TriparClient) GetObject(
	ctx context.Context,
	path string,
	span *ioutils.FileSpan,
) (rd io.ReadCloser, info *Stat, err error)

func (*TriparClient) List

func (tp *TriparClient) List(ctx context.Context, path string) (entries Entries, err error)

func (*TriparClient) MoveObject

func (tp *TriparClient) MoveObject(ctx context.Context, path string, nupath string) (err error)

func (*TriparClient) PutObject

func (tp *TriparClient) PutObject(ctx context.Context, path string, reader io.Reader) (err error)

func (*TriparClient) Stat

func (tp *TriparClient) Stat(ctx context.Context, path string) (info Stat, err error)

Jump to

Keyboard shortcuts

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