util

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 15, 2019 License: Unlicense Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Fail

func Fail(err error, msg string)

Fail prints out the error, additional message and exits the program with code 1 while also zeroing all memguard buffers.

func GetDefaultProfileLoc

func GetDefaultProfileLoc() string

GetDefaultProfileLoc returns the default ogive profile location

func GetPartSize

func GetPartSize(size int64) int64

GetPartSize returns the part size for multipart upload. For files less than 500 MiB the part size is 5 MiB For files between 500 MiB and 5 000 MiB part size grows dynamically to create a 100-part upload For files between 5 000 MiB and 50 000 MiB the part size is 50 MiB and part count increases For files more than 50 000 MiB part count is 10 000 and part size starts to grow again

func GetSession

func GetSession(i *profile.InnerData) *session.Session

GetSession uses ogive profile data to create a new AWS session.

func SizeIEC

func SizeIEC(b int64) string

SizeIEC transforms a bytesize into an approximate (1 decimal place) IEC-compliant representation. It supports sizes up to 1000 TiB which is more than plenty for S3 maximum of 5 TB

Types

type WriterAtFake

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

WriterAtFake is used to implement fake compliance with the io.WriteAt interface while also validating the first two bytes for sio

func NewWriterAtFake

func NewWriterAtFake(w io.Writer) WriterAtFake

NewWriterAtFake wraps an io.Writer into a dummy io.WriterAt interface.

func (WriterAtFake) WriteAt

func (w WriterAtFake) WriteAt(p []byte, offset int64) (s int, err error)

WriteAt is a dummy positional writer method. It ignores the offset and writes into the original Writer sequentially. This implementation is ogive-specific and omits first two bytes, making sure they are 0x20 0x00. See ogive/cmd/get.go source code for an explanation.

Jump to

Keyboard shortcuts

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