Documentation ¶
Index ¶
- Constants
- Variables
- func DailTimeOut(target string, timeout time.Duration) (c *net.TCPConn, err error)
- func GetMemInfo() (total, used uint64, err error)
- func GetProcessMemory(pid int) (used uint64, err error)
- func IsIPV4(val interface{}) bool
- func Max(a, b int) int
- func Min(a, b int) int
- func RandomString(length int, seed RandomSeed) string
- func SubString(sourceString string, begin, end int) string
- type ConnectPool
- type MasterHelper
- type MultipartID
- type Object
- type Pool
- type RandomSeed
Constants ¶
View Source
const ( MEMINFO = "/proc/meminfo" PRO_MEM = "/proc/%d/status" )
View Source
const ( KB = 1 << (10 * iota) MB GB TB PB DefaultDataPartitionSize = 120 * GB TaskWorkerInterval = 1 )
View Source
const ( BlockCount = 1024 BlockSize = 65536 * 2 ReadBlockSize = BlockSize PerBlockCrcSize = 4 ExtentSize = BlockCount * BlockSize PacketHeaderSize = 57 BlockHeaderSize = 4096 )
View Source
const (
ConnectIdleTime = 30
)
View Source
const (
DefaultTinySizeLimit = 1 * MB // TODO explain tiny extent?
)
Variables ¶
View Source
var (
ErrNoValidMaster = errors.New("no valid master")
)
Functions ¶
func DailTimeOut ¶ added in v1.4.0
func GetMemInfo ¶
GetMemInfo returns the memory information.
func GetProcessMemory ¶ added in v1.1.0
func RandomString ¶ added in v1.5.0
func RandomString(length int, seed RandomSeed) string
Types ¶
type ConnectPool ¶
func NewConnectPool ¶
func NewConnectPool() (cp *ConnectPool)
func (*ConnectPool) Close ¶
func (cp *ConnectPool) Close()
func (*ConnectPool) GetConnect ¶
func (cp *ConnectPool) GetConnect(targetAddr string) (c *net.TCPConn, err error)
func (*ConnectPool) PutConnect ¶
func (cp *ConnectPool) PutConnect(c *net.TCPConn, forceClose bool)
type MasterHelper ¶
type MasterHelper interface { AddNode(address string) Nodes() []string Leader() string Request(method, path string, param, header map[string]string, body []byte) (data []byte, err error) }
MasterHelper defines the helper struct to manage the master.
func NewMasterHelper ¶
func NewMasterHelper() MasterHelper
NewMasterHelper returns a new MasterHelper instance.
type MultipartID ¶
type MultipartID string
func CreateMultipartID ¶
func CreateMultipartID(mpId uint64) MultipartID
func MultipartIDFromString ¶
func MultipartIDFromString(src string) MultipartID
func (MultipartID) PartitionID ¶
func (id MultipartID) PartitionID() (pID uint64, found bool)
func (MultipartID) String ¶
func (id MultipartID) String() string
type Pool ¶
type Pool struct {
// contains filtered or unexported fields
}
func (*Pool) PutConnectObjectToPool ¶
func (*Pool) ReleaseAll ¶
func (p *Pool) ReleaseAll()
type RandomSeed ¶ added in v1.5.0
type RandomSeed byte
const ( Numeric RandomSeed = 1 << iota LowerLetter UpperLetter )
func (RandomSeed) Runes ¶ added in v1.5.0
func (s RandomSeed) Runes() []rune
Source Files ¶
Click to show internal directories.
Click to hide internal directories.