Documentation ¶
Index ¶
- Constants
- Variables
- func Base64Encode(data []byte) string
- func Base64Md5(data []byte) string
- func Base64Md5ToBytes(contentMd5 string) []byte
- func BytesToHumanReadable(b uint64) string
- func BytesToUint16(b []byte) (v uint16)
- func BytesToUint32(b []byte) (v uint32)
- func BytesToUint64(b []byte) (v uint64)
- func CanonicalizeETag(etag string) string
- func CheckFile(filename string) (exists, canRead, canWrite bool, modTime time.Time, fileSize int64)
- func CloseRequest(req *http.Request)
- func CloseResponse(resp *http.Response)
- func DecompressData(input []byte) ([]byte, error)
- func Decrypt(ciphertext []byte, key CipherKey) ([]byte, error)
- func Delete(url string, jwt string) error
- func DeleteProxied(url string, jwt string) (body []byte, httpStatus int, err error)
- func DetectedHostAddress() string
- func Do(req *http.Request) (resp *http.Response, err error)
- func DownloadFile(fileUrl string, jwt string) (filename string, header http.Header, resp *http.Response, e error)
- func EmptyTo(s, to string) string
- func Encrypt(plaintext []byte, key CipherKey) ([]byte, error)
- func FileExists(filename string) bool
- func FileNameBase(filename string) string
- func Get(url string) ([]byte, bool, error)
- func GetBufferStream(url string, values url.Values, allocatedBytes []byte, eachBuffer func([]byte)) error
- func GetFileSize(file *os.File) (size int64, err error)
- func GetFileUidGid(fi os.FileInfo) (uid, gid uint32)
- func GetUrlStream(url string, values url.Values, readFn func(io.Reader) error) error
- func GunzipStream(w io.Writer, r io.Reader) (int64, error)
- func GzipData(input []byte) ([]byte, error)
- func GzipStream(w io.Writer, r io.Reader) (int64, error)
- func HashStringToLong(dir string) (v int64)
- func HashToInt32(data []byte) (v int32)
- func Head(url string) (http.Header, error)
- func HumanReadableInts(ids ...int) string
- func HumanReadableIntsMax(max int, ids ...int) string
- func IfElse(b bool, this, that string) string
- func IsCompressableFileType(ext, mtype string) (shouldBeCompressed, iAmSure bool)
- func IsEmpty(given interface{}) bool
- func IsGzippedContent(data []byte) bool
- func IsNotEmpty(given interface{}) bool
- func Join(names ...string) string
- func JoinHostPort(host string, port int) string
- func LoadConfiguration(configFileName string, required bool) (loaded bool)
- func MaybeDecompressData(input []byte) []byte
- func MaybeGzipData(input []byte) []byte
- func Md5(data []byte) []byte
- func Md5String(data []byte) string
- func NewIpAndLocalListeners(host string, port int, timeout time.Duration) (ipListner net.Listener, localListener net.Listener, err error)
- func NewListener(addr string, timeout time.Duration) (ipListner net.Listener, err error)
- func NormalizeUrl(url string) string
- func Nvl(values ...string) string
- func ParseBytes(s string) (uint64, error)
- func ParseFilerUrl(entryPath string) (filerServer string, filerPort int64, path string, err error)
- func ParseHostPort(hostPort string) (filerServer string, filerPort int64, err error)
- func ParseInt(text string, defaultValue int) int
- func ParseUint64(text string, defaultValue uint64) uint64
- func Post(url string, values url.Values) ([]byte, error)
- func RandomBytes(byteCount int) []byte
- func RandomInt32() int32
- func ReadUrl(fileUrl string, cipherKey []byte, isContentCompressed bool, isFullChunk bool, ...) (int64, error)
- func ReadUrlAsReaderCloser(fileUrl string, jwt string, rangeHeader string) (io.ReadCloser, error)
- func ReadUrlAsStream(fileUrl string, cipherKey []byte, isContentGzipped bool, isFullChunk bool, ...) (retryable bool, err error)
- func ResolvePath(path string) string
- func Retry(name string, job func() error) (err error)
- func RetryForever(name string, job func() error, onErrFn func(err error) (shouldContinue bool))
- func TestFolderWritable(folder string) (err error)
- func Uint16toBytes(b []byte, v uint16)
- func Uint32toBytes(b []byte, v uint32)
- func Uint64toBytes(b []byte, v uint64)
- func Uint8toBytes(b []byte, v uint8)
- func Version() string
- func WriteFile(name string, data []byte, perm os.FileMode) error
- type BytesReader
- type CipherKey
- type ConcurrentReadMap
- type Configuration
- type Conn
- type CountingReader
- type DirectoryValueType
- type FullPath
- type LimitedConcurrentExecutor
- type LimitedOutOfOrderProcessor
- type Listener
- type MinFreeSpace
- type MinFreeSpaceType
- type OperationRequest
- type Queue
- type UnboundedQueue
- type ViperProxy
- type WriteThrottler
Constants ¶
const ( Byte = 1 << (iota * 10) KiByte MiByte GiByte TiByte PiByte EiByte )
IEC Sizes. kibis of bits
const ( IByte = 1 KByte = IByte * 1000 MByte = KByte * 1000 GByte = MByte * 1000 TByte = GByte * 1000 PByte = TByte * 1000 EByte = PByte * 1000 )
SI Sizes.
const (
VolumeSizeLimitGB = 30
)
Variables ¶
var ( VERSION_NUMBER = fmt.Sprintf("%.02f", 3.18) VERSION = sizeLimit + " " + VERSION_NUMBER COMMIT = "" )
var ErrMinFreeSpaceBadValue = errors.New("minFreeSpace is invalid")
var RetryWaitTime = 6 * time.Second
var (
Transport *http.Transport
)
var (
UnsupportedCompression = fmt.Errorf("unsupported compression")
)
Functions ¶
func Base64Encode ¶
func Base64Md5ToBytes ¶
func BytesToHumanReadable ¶
BytesToHumanReadable returns the converted human readable representation of the bytes.
func BytesToUint16 ¶
func BytesToUint32 ¶
func BytesToUint64 ¶
func CanonicalizeETag ¶
func CloseRequest ¶
func CloseResponse ¶
func DecompressData ¶
func DeleteProxied ¶
func DetectedHostAddress ¶
func DetectedHostAddress() string
func DownloadFile ¶
func FileExists ¶
func FileNameBase ¶
func Get ¶
github.com/chrislusf/seaweedfs/unmaintained/repeated_vacuum/repeated_vacuum.go may need increasing http.Client.Timeout
func GetBufferStream ¶
func GetFileUidGid ¶
func GetUrlStream ¶
func HashToInt32 ¶
func HumanReadableInts ¶
HumanReadableInts joins a serials of inits into a smart one like 1-3 5 7-10 for human readable.
func HumanReadableIntsMax ¶
HumanReadableIntsMax joins a serials of inits into a smart one like 1-3 5 ... for human readable.
func IsCompressableFileType ¶
func IsEmpty ¶
func IsEmpty(given interface{}) bool
IsEmpty returns true if the given value has the zero value for its type.
func IsGzippedContent ¶
func IsNotEmpty ¶
func IsNotEmpty(given interface{}) bool
IsNotEmpty returns true if the given value is not zero or empty.
func JoinHostPort ¶
func LoadConfiguration ¶
func MaybeDecompressData ¶
func MaybeGzipData ¶
func NewIpAndLocalListeners ¶
func NewListener ¶
func NormalizeUrl ¶
func ParseBytes ¶
ParseBytes parses a string representation of bytes into the number of bytes it represents.
See Also: Bytes, IBytes.
ParseBytes("42MB") -> 42000000, nil ParseBytes("42 MB") -> 42000000, nil ParseBytes("42 mib") -> 44040192, nil
func ParseFilerUrl ¶
func ParseHostPort ¶
func ParseUint64 ¶
func RandomBytes ¶
func RandomInt32 ¶
func RandomInt32() int32
func ReadUrlAsReaderCloser ¶
func ReadUrlAsStream ¶
func ResolvePath ¶
func RetryForever ¶
func TestFolderWritable ¶
func Uint16toBytes ¶
func Uint32toBytes ¶
func Uint64toBytes ¶
func Uint8toBytes ¶
Types ¶
type BytesReader ¶
func NewBytesReader ¶
func NewBytesReader(b []byte) *BytesReader
type ConcurrentReadMap ¶
A mostly for read map, which can thread-safely initialize the map entries.
func NewConcurrentReadMap ¶
func NewConcurrentReadMap() *ConcurrentReadMap
func (*ConcurrentReadMap) Delete ¶
func (m *ConcurrentReadMap) Delete(key string)
func (*ConcurrentReadMap) Find ¶
func (m *ConcurrentReadMap) Find(key string) (interface{}, bool)
func (*ConcurrentReadMap) Get ¶
func (m *ConcurrentReadMap) Get(key string, newEntry func() interface{}) interface{}
func (*ConcurrentReadMap) Items ¶
func (m *ConcurrentReadMap) Items() (itemsCopy []interface{})
type Configuration ¶
type Conn ¶
type Conn struct { net.Conn ReadTimeout time.Duration WriteTimeout time.Duration // contains filtered or unexported fields }
Conn wraps a net.Conn, and sets a deadline for every read and write operation.
type CountingReader ¶
type CountingReader struct { BytesRead int // contains filtered or unexported fields }
type DirectoryValueType ¶
type DirectoryValueType string
var (
ConfigurationFileDirectory DirectoryValueType
)
func (*DirectoryValueType) Set ¶
func (s *DirectoryValueType) Set(value string) error
func (*DirectoryValueType) String ¶
func (s *DirectoryValueType) String() string
type FullPath ¶
type FullPath string
func NewFullPath ¶
func (FullPath) DirAndName ¶
type LimitedConcurrentExecutor ¶
type LimitedConcurrentExecutor struct {
// contains filtered or unexported fields
}
LimitedConcurrentExecutor object
func NewLimitedConcurrentExecutor ¶
func NewLimitedConcurrentExecutor(limit int) *LimitedConcurrentExecutor
func (*LimitedConcurrentExecutor) Execute ¶
func (c *LimitedConcurrentExecutor) Execute(job func())
Execute adds a function to the execution queue. if num of go routines allocated by this instance is < limit launch a new go routine to execute job else wait until a go routine becomes available
type LimitedOutOfOrderProcessor ¶
type LimitedOutOfOrderProcessor struct {
// contains filtered or unexported fields
}
func NewLimitedOutOfOrderProcessor ¶
func NewLimitedOutOfOrderProcessor(limit int32) (c *LimitedOutOfOrderProcessor)
func (*LimitedOutOfOrderProcessor) Execute ¶
func (c *LimitedOutOfOrderProcessor) Execute(request OperationRequest)
type Listener ¶
Listener wraps a net.Listener, and gives a place to store the timeout parameters. On Accept, it will wrap the net.Conn with our own Conn for us.
type MinFreeSpace ¶
type MinFreeSpace struct { Type MinFreeSpaceType Bytes uint64 Percent float32 Raw string }
MinFreeSpace is type that defines the limit for the minimum free space.
func MustParseMinFreeSpace ¶
func MustParseMinFreeSpace(minFreeSpace string, minFreeSpacePercent string) (spaces []MinFreeSpace)
MustParseMinFreeSpace parses comma-separated argument for min free space setting. minFreeSpace has the high priority than minFreeSpacePercent if it is set.
func ParseMinFreeSpace ¶
func ParseMinFreeSpace(s string) (*MinFreeSpace, error)
ParseMinFreeSpace parses min free space expression s as percentage like 1,10 or human readable size like 10G
func (MinFreeSpace) IsLow ¶
func (s MinFreeSpace) IsLow(freeBytes uint64, freePercent float32) (yes bool, desc string)
IsLow tells whether the free space is low or not.
func (MinFreeSpace) String ¶
func (s MinFreeSpace) String() string
String returns a string representation of MinFreeSpace.
type MinFreeSpaceType ¶
type MinFreeSpaceType int
MinFreeSpaceType is the type of MinFreeSpace.
const ( // AsPercent set the MinFreeSpaceType to a percentage value from 0 to 100. AsPercent MinFreeSpaceType = iota // AsBytes set the MinFreeSpaceType to a absolute value bytes. AsBytes )
type OperationRequest ¶
type OperationRequest func()
a different implementation, but somehow more "conservative"
type UnboundedQueue ¶
type UnboundedQueue struct {
// contains filtered or unexported fields
}
func NewUnboundedQueue ¶
func NewUnboundedQueue() *UnboundedQueue
func (*UnboundedQueue) Consume ¶
func (q *UnboundedQueue) Consume(fn func([]string))
func (*UnboundedQueue) EnQueue ¶
func (q *UnboundedQueue) EnQueue(items ...string)
type ViperProxy ¶
func GetViper ¶
func GetViper() *ViperProxy
func (*ViperProxy) GetBool ¶
func (vp *ViperProxy) GetBool(key string) bool
func (*ViperProxy) GetInt ¶
func (vp *ViperProxy) GetInt(key string) int
func (*ViperProxy) GetString ¶
func (vp *ViperProxy) GetString(key string) string
func (*ViperProxy) GetStringSlice ¶
func (vp *ViperProxy) GetStringSlice(key string) []string
func (*ViperProxy) SetDefault ¶
func (vp *ViperProxy) SetDefault(key string, value interface{})
type WriteThrottler ¶
type WriteThrottler struct {
// contains filtered or unexported fields
}
func NewWriteThrottler ¶
func NewWriteThrottler(bytesPerSecond int64) *WriteThrottler
func (*WriteThrottler) MaybeSlowdown ¶
func (wt *WriteThrottler) MaybeSlowdown(delta int64)
Source Files ¶
- bytes.go
- cipher.go
- compression.go
- compression_stream.go
- concurrent_read_map.go
- config.go
- constants.go
- constants_4bytes.go
- file_util.go
- file_util_non_posix.go
- fullpath.go
- http_util.go
- inits.go
- limiter.go
- minfreespace.go
- net_timeout.go
- network.go
- parse.go
- queue.go
- queue_unbounded.go
- reflect.go
- retry.go
- throttler.go
Directories ¶
Path | Synopsis |
---|---|
Package flag implements command-line flag parsing.
|
Package flag implements command-line flag parsing. |
Package httpdown provides http.ConnState enabled graceful termination of http.Server.
|
Package httpdown provides http.ConnState enabled graceful termination of http.Server. |