utils

package
v0.0.0-...-8b27293 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2021 License: Apache-2.0 Imports: 23 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddMoreUserMeta

func AddMoreUserMeta(metad map[string]string, source string) map[string]string

func BuildUserMeta

func BuildUserMeta(meta []byte) map[string]*string

func BuildUsermd

func BuildUsermd(usermd map[string]string) map[string]*string

func DelStack

func DelStack(s Stack)

func Ebc2asci

func Ebc2asci(ebc []byte) []byte

func Exist

func Exist(path string) bool

func GenAutoCompletionScript

func GenAutoCompletionScript(rootcmd *cobra.Command, pathname string)

func GetBucket

func GetBucket(viper viper.Viper) int

func GetBucketdUrl

func GetBucketdUrl(viper viper.Viper) string

func GetHomeDir

func GetHomeDir() string

Return home directory

func GetLevelDBUrl

func GetLevelDBUrl(viper viper.Viper) string

func GetLogCombine

func GetLogCombine(viper viper.Viper) bool

func GetLogOutput

func GetLogOutput(viper viper.Viper) string

func GetNumberOfBucket

func GetNumberOfBucket(viper viper.Viper) int

func GetPxiMeta

func GetPxiMeta(metad map[string]*string) (string, error)

func GetRetryNumber

func GetRetryNumber(viper viper.Viper) int

func GetTopology

func GetTopology(viper viper.Viper) string

func GetUserMeta

func GetUserMeta(metad map[string]*string) (string, error)

func GetVersionId

func GetVersionId(metad map[string]*string) (string, error)

func GetWaitTime

func GetWaitTime(viper viper.Viper) time.Duration

func HashKey

func HashKey(key string, modulo int) int

func InitConfig

func InitConfig(config string, viper viper.Viper, rootcmd cobra.Command)

func KeyToAscii

func KeyToAscii(key string) int

func ListFile

func ListFile(root string)

func LumberPrefix

func LumberPrefix(cmd *cobra.Command) time.Time

func MakeDir

func MakeDir(dir string)

create a directory if it does not exist

func ParseSindexdLog

func ParseSindexdLog()

func PrintBucketAcl

func PrintBucketAcl(r *s3.GetBucketAclOutput)

func PrintGrantee

func PrintGrantee(grant []*s3.Grant)

func PrintMetadata

func PrintMetadata(metad map[string]*string)

func PrintObjectAcl

func PrintObjectAcl(r *s3.GetObjectAclOutput)

func PrintPxiMeta

func PrintPxiMeta(key string, metad map[string]*string)

func PrintUserMeta

func PrintUserMeta(key string, metad map[string]*string)

func PrintUsermd

func PrintUsermd(key string, metad map[string]*string)

func ProcS3Error

func ProcS3Error(err error)

func ReadBuffer

func ReadBuffer(filename string) (*bytes.Buffer, error)

func ReadDataDir

func ReadDataDir(dir string) ([]os.FileInfo, error)

return all data files of a directory

func ReadDirectory

func ReadDirectory(dirname string, filter string) ([]string, error)

func ReadFile

func ReadFile(filename string) ([]byte, error)

func ReadLines

func ReadLines(filename string) error

func ReadObject

func ReadObject(object io.Reader) (*bytes.Buffer, error)

object is io reader

func ReadObjectv

func ReadObjectv(object io.Reader, bufsize int) (*bytes.Buffer, error)

func ReadUsermd

func ReadUsermd(pathname string) (map[string]string, error)

func Return

func Return(start time.Time)

func Reverse

func Reverse(s string) string

Reverse returns its argument string reversed rune-wise left to right.

func SaveObject

func SaveObject(result *s3.GetObjectOutput, pathname string) error

func ScanAllLines

func ScanAllLines(scanner *bufio.Scanner) ([]string, error)

func ScanLines

func ScanLines(scanner *bufio.Scanner, num int) ([]string, error)

func Scanner

func Scanner(pathname string) (scanner *bufio.Scanner, err error)

func SetCPU

func SetCPU(cpu string) error

func SetLogLevel

func SetLogLevel(viper viper.Viper, loglevel int) int

func StructToMap

func StructToMap(i interface{}) map[string]interface{}

func WriteFile

func WriteFile(filename string, buf []byte, mode os.FileMode) error

func WriteObj

func WriteObj(b *bytes.Buffer, pathname string)

func WriteUserMeta

func WriteUserMeta(metad map[string]*string, pathname string)

func WriteUsermd

func WriteUsermd(metad map[string]*string, pathname string)

Types

type Node

type Node struct {
	Address int64
}

Stack's node

func (*Node) HexString

func (n *Node) HexString() string

func (*Node) String

func (n *Node) String() string

type Rf

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

func AsyncReadFiles

func AsyncReadFiles(entries []string) []*Rf

func AsyncWriteFiles

func AsyncWriteFiles(entries []string, buf [][]byte, mode os.FileMode) []*Rf

type Stack

type Stack struct {
	Nodes []*Node
	Count int
}

Stack is a basic LIFO stack that resizes as needed.

func NewStack

func NewStack(size int) Stack

func (*Stack) Pop

func (s *Stack) Pop() *Node

func (*Stack) Push

func (s *Stack) Push(n *Node)

Push -> adds a node to the stack

type VBReader

type VBReader interface {
	SetCurrent(int64)
	GetCurrent() int64

	GetPrevious() int64
	Read() ([]byte, error)
	GetRecord(int) ([]byte, error)
	ReadAt([]byte) (int, error)
	// contains filtered or unexported methods
}

type VBRecord

type VBRecord struct {
	File     *os.File      // File  -> File descriptor of the VB file
	Buffer   *bytes.Buffer // in memory buffer
	Size     int64         // Size of the file
	Current  int64         //  Current address of the record to read
	Previous int64         //  Pointer to previous recod ( BDW,RDW,data)
	Stack    Stack         //  size  stack

}

func NewVBRecord

func NewVBRecord(infile string) (*VBRecord, error)

create a new VBtoRecord instance

func (*VBRecord) GetCurrent

func (r *VBRecord) GetCurrent() int64

Return the location of the current record

func (*VBRecord) GetPrevious

func (r *VBRecord) GetPrevious() int64

return the location of the previous record

func (*VBRecord) GetRecord

func (vb *VBRecord) GetRecord(n int) ([]byte, error)

func (*VBRecord) Read

func (vb *VBRecord) Read() ([]byte, error)

func (*VBRecord) ReadAt

func (vb *VBRecord) ReadAt(b []byte) (int, error)

read b bytes from the current position

func (*VBRecord) SetCurrent

func (r *VBRecord) SetCurrent(c int64)

Set position of the current record to read

Jump to

Keyboard shortcuts

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