Documentation ¶
Index ¶
- Constants
- Variables
- func Any2String(value interface{}) string
- func CalcAuthKey(key string) (authKey string)
- func DailTimeOut(target string, timeout time.Duration) (c *net.TCPConn, err error)
- func DefaultSmuxConfig() *smux.Config
- func FilterSmuxAcceptError(err error) error
- func GenerateKey(volName string, ino uint64, offset uint64) string
- func GenerateRepVolKey(volName string, ino uint64, dpId uint64, extentId uint64, offset uint64) string
- func GetIp(addr string) (ip string)
- func GetMemInfo() (total, used uint64, err error)
- func GetProcessMemory(pid int) (used uint64, err error)
- func IsIPV4(val interface{}) bool
- func IsIPV4Addr(ipAddr string) bool
- func Max(a, b int) int
- func Min(a, b int) int
- func OneDaySec() int64
- func ParseAddrToIpAddr(addr string) (ipAddr string, success bool)
- func ParseDomainAddrToIpAddr(domainAddr string) (ipAddr string, success bool)
- func ParseIpAddrToDomainAddr(ipAddr string) (domainAddr string)
- func RandomString(length int, seed RandomSeed) string
- func RecvFd(socket *os.File) (*os.File, error)
- func SendFd(socket *os.File, name string, fd uintptr) error
- func SendFds(socket *os.File, msg []byte, fds ...int) error
- func ShiftAddrPort(addr string, shift int) (afterShift string)
- func String2Any(str string, pvalue interface{}) error
- func SubString(sourceString string, begin, end int) string
- func VerifySmuxPoolConfig(cfg *SmuxConnPoolConfig) error
- type BloomFilter
- type ConnectPool
- type Future
- type MasterHelper
- type MultiVersionSeq
- type MultipartID
- type Null
- type Object
- type Pool
- type RandomSeed
- type RecycleTimer
- type Set
- type SmuxConnPoolConfig
- type SmuxConnPoolStat
- type SmuxConnectPool
- type SmuxPool
- type SmuxPoolStat
Constants ¶
const ( MEMINFO = "/proc/meminfo" PRO_MEM = "/proc/%d/status" )
const ( KB = 1 << (10 * iota) MB GB TB PB DefaultDataPartitionSize = 120 * GB TaskWorkerInterval = 1 )
const ( BlockCount = 1024 BlockSize = 65536 * 2 ReadBlockSize = BlockSize RepairReadBlockSize = 512 * util.KB PerBlockCrcSize = 4 ExtentSize = BlockCount * BlockSize PacketHeaderSize = 57 BlockHeaderSize = 4096 SyscallTryMaxTimes = 3 PacketHeaderVerSize = 65 )
const ( PageSize = 4 * util.KB FallocFLKeepSize = 1 FallocFLPunchHole = 2 )
const ( AclListIP = 0 AclAddIP = 1 AclDelIP = 2 AclCheckIP = 3 )
const ( UidLimitList = 0 UidAddLimit = 1 UidDelLimit = 2 UidGetLimit = 3 )
const (
ConnectIdleTime = 30
)
const (
DefaultSmuxPortShift = 500
)
const (
DefaultTinySizeLimit = 1 * MB // TODO explain tiny extent?
)
const MaxNameLen = 4096
MaxSendfdLen is the maximum length of the name of a file descriptor being sent using SendFd. The name of the file handle returned by RecvFd will never be larger than this value.
Variables ¶
var ErrNoValidMaster = errors.New("no valid master")
var ErrTooMuchSmuxStreams = errors.New("too much smux streams")
Functions ¶
func Any2String ¶ added in v1.34.0
func Any2String(value interface{}) string
Any2String format any value to string.
func CalcAuthKey ¶ added in v1.34.0
func DailTimeOut ¶ added in v1.4.0
func DefaultSmuxConfig ¶ added in v1.34.0
func FilterSmuxAcceptError ¶ added in v1.34.0
FilterSmuxAcceptError filter smux accept error
func GenerateKey ¶ added in v1.34.0
func GenerateRepVolKey ¶ added in v1.34.0
func GetMemInfo ¶
GetMemInfo returns the memory information.
func GetProcessMemory ¶ added in v1.1.0
func IsIPV4Addr ¶ added in v1.34.0
func ParseAddrToIpAddr ¶ added in v1.34.0
func ParseDomainAddrToIpAddr ¶ added in v1.34.0
func ParseIpAddrToDomainAddr ¶ added in v1.34.0
func RandomString ¶ added in v1.5.0
func RandomString(length int, seed RandomSeed) string
func RecvFd ¶ added in v1.34.0
RecvFd waits for a file descriptor to be sent over the given AF_UNIX socket. The file name of the remote file descriptor will be recreated locally (it is sent as non-auxiliary data in the same payload).
func SendFd ¶ added in v1.34.0
SendFd sends a file descriptor over the given AF_UNIX socket. In addition, the file.Name() of the given file will also be sent as non-auxiliary data in the same payload (allowing to send contextual information for a file descriptor).
func SendFds ¶ added in v1.34.0
SendFds sends a list of files descriptor and msg over the given AF_UNIX socket.
func ShiftAddrPort ¶ added in v1.34.0
ShiftAddrPort changes the addr(ip:port) to afterShift(ip:(port+shift)).
func String2Any ¶ added in v1.34.0
Any2String parse string to pointer of value.
func VerifySmuxPoolConfig ¶ added in v1.34.0
func VerifySmuxPoolConfig(cfg *SmuxConnPoolConfig) error
Types ¶
type BloomFilter ¶ added in v1.34.0
type BloomFilter struct {
// contains filtered or unexported fields
}
func NewBloomFilter ¶ added in v1.34.0
func NewBloomFilter(size uint64, hashFunc ...func(data []byte) uint64) *BloomFilter
func (*BloomFilter) Add ¶ added in v1.34.0
func (bf *BloomFilter) Add(data []byte)
func (*BloomFilter) Contains ¶ added in v1.34.0
func (bf *BloomFilter) Contains(data []byte) bool
type ConnectPool ¶
func NewConnectPool ¶
func NewConnectPool() (cp *ConnectPool)
func NewConnectPoolWithTimeout ¶ added in v1.34.0
func NewConnectPoolWithTimeout(idleConnTimeout time.Duration, connectTimeout int64) (cp *ConnectPool)
func (*ConnectPool) Close ¶ added in v1.34.0
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)
func (*ConnectPool) PutConnectEx ¶ added in v1.34.0
func (cp *ConnectPool) PutConnectEx(c *net.TCPConn, err error)
func (*ConnectPool) ReleaseAll ¶ added in v1.34.0
func (cp *ConnectPool) ReleaseAll(addr net.Addr)
type Future ¶ added in v1.34.0
type Future struct {
// contains filtered or unexported fields
}
Future the future
func (*Future) AsyncResponse ¶ added in v1.34.0
AsyncResponse export channels
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 MultiVersionSeq ¶ added in v1.34.0
type MultiVersionSeq uint64
type MultipartID ¶ added in v1.34.0
type MultipartID string
func CreateMultipartID ¶ added in v1.34.0
func CreateMultipartID(mpId uint64) MultipartID
func MultipartIDFromString ¶ added in v1.34.0
func MultipartIDFromString(src string) MultipartID
func (MultipartID) PartitionID ¶ added in v1.34.0
func (id MultipartID) PartitionID() (pID uint64, found bool)
func (MultipartID) String ¶ added in v1.34.0
func (id MultipartID) String() string
type Pool ¶
type Pool struct {
// contains filtered or unexported fields
}
func (*Pool) PutConnectObjectToPool ¶
func (*Pool) ReleaseAll ¶ added in v1.34.0
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
type RecycleTimer ¶ added in v1.34.0
type RecycleTimer struct {
// contains filtered or unexported fields
}
func NewRecycleTimer ¶ added in v1.34.0
func (*RecycleTimer) SetPanicHook ¶ added in v1.34.0
func (r *RecycleTimer) SetPanicHook(handle func(r interface{}))
func (*RecycleTimer) SetStatHook ¶ added in v1.34.0
func (r *RecycleTimer) SetStatHook(handle func(totalPercent float64, currentProcess uint64, currentGoHeap uint64))
func (*RecycleTimer) Stop ¶ added in v1.34.0
func (r *RecycleTimer) Stop()
type SmuxConnPoolConfig ¶ added in v1.34.0
type SmuxConnPoolConfig struct { *smux.Config TotalStreams int StreamsPerConn int ConnsPerAddr int PoolCapacity int DialTimeout time.Duration StreamIdleTimeout int64 }
func DefaultSmuxConnPoolConfig ¶ added in v1.34.0
func DefaultSmuxConnPoolConfig() *SmuxConnPoolConfig
type SmuxConnPoolStat ¶ added in v1.34.0
type SmuxConnectPool ¶ added in v1.34.0
func NewSmuxConnectPool ¶ added in v1.34.0
func NewSmuxConnectPool(cfg *SmuxConnPoolConfig) (cp *SmuxConnectPool)
func (*SmuxConnectPool) Close ¶ added in v1.34.0
func (cp *SmuxConnectPool) Close()
func (*SmuxConnectPool) GetConnect ¶ added in v1.34.0
func (cp *SmuxConnectPool) GetConnect(targetAddr string) (c *smux.Stream, err error)
func (*SmuxConnectPool) GetStat ¶ added in v1.34.0
func (cp *SmuxConnectPool) GetStat() *SmuxConnPoolStat
func (*SmuxConnectPool) PutConnect ¶ added in v1.34.0
func (cp *SmuxConnectPool) PutConnect(stream *smux.Stream, forceClose bool)
type SmuxPool ¶ added in v1.34.0
type SmuxPool struct {
// contains filtered or unexported fields
}
func NewSmuxPool ¶ added in v1.34.0
func NewSmuxPool(cfg *SmuxConnPoolConfig, target string, streamBucket *simpleTokenBucket) (p *SmuxPool)
func (*SmuxPool) GetConnect ¶ added in v1.34.0
func (*SmuxPool) GetStat ¶ added in v1.34.0
func (p *SmuxPool) GetStat() *SmuxPoolStat
func (*SmuxPool) MarkClosed ¶ added in v1.34.0
func (*SmuxPool) PutStreamObjectToPool ¶ added in v1.34.0
func (p *SmuxPool) PutStreamObjectToPool(obj *streamObject)
func (*SmuxPool) ReleaseAll ¶ added in v1.34.0
func (p *SmuxPool) ReleaseAll()
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package btree implements in-memory B-Trees of arbitrary degree.
|
Package btree implements in-memory B-Trees of arbitrary degree. |
Package ratelimit RateLimit Algorithm Based on Token Bucket
|
Package ratelimit RateLimit Algorithm Based on Token Bucket |
mocktest
|
|
raftstore
Package raftstoremock is a generated GoMock package.
|
Package raftstoremock is a generated GoMock package. |