Documentation
¶
Index ¶
- Constants
- Variables
- type ChunkServer
- func (cs *ChunkServer) DeleteData(groupId, fileId string, conn *PooledConn) error
- func (cs *ChunkServer) GetData(miv *meta.MetaInfoValue, conn *PooledConn) ([]byte, error)
- func (csi *ChunkServer) HostInfoEqual(another *ChunkServer) bool
- func (cs *ChunkServer) Ping(conn *PooledConn) error
- func (cs *ChunkServer) PutData(data []byte, conn *PooledConn, fileId uint64) error
- type ChunkServerConnectionPool
- func (cscp *ChunkServerConnectionPool) AddExistPool(key string, pool *ConnectionPool)
- func (cscp *ChunkServerConnectionPool) AddPool(chunkserver *ChunkServer, capacity int) error
- func (cscp *ChunkServerConnectionPool) CheckConnPool(chunkserver *ChunkServer) error
- func (cscp *ChunkServerConnectionPool) GetConn(chunkserver *ChunkServer) (PoolConnection, error)
- func (cscp *ChunkServerConnectionPool) ReleaseConn(pc PoolConnection)
- func (cscp *ChunkServerConnectionPool) RemoveAndClosePool(chunkserver *ChunkServer) error
- func (cscp *ChunkServerConnectionPool) RemovePool(chunkserver *ChunkServer)
- type ChunkServerGroups
- type Conn
- type ConnectionPool
- func (cp *ConnectionPool) Capacity() int64
- func (cp *ConnectionPool) Close()
- func (cp *ConnectionPool) Get() (PoolConnection, error)
- func (cp *ConnectionPool) IdleTimeout() time.Duration
- func (cp *ConnectionPool) MaxCap() int64
- func (cp *ConnectionPool) Open(connFactory CreateConnectionFunc)
- func (cp *ConnectionPool) Put(conn PoolConnection)
- func (cp *ConnectionPool) SetCapacity(capacity int) (err error)
- func (cp *ConnectionPool) SetIdleTimeOut(idleTimeout time.Duration)
- func (cp *ConnectionPool) StatsJSON() string
- func (cp *ConnectionPool) TryGet() (PoolConnection, error)
- func (cp *ConnectionPool) WaitCount() int64
- func (cp *ConnectionPool) WaitTime() time.Duration
- type CreateConnectionFunc
- type Fids
- type HeapElement
- type MinHeap
- type PoolConnection
- type PooledConn
- type Resp
Constants ¶
View Source
const ( RW_STATUS = 1 RO_STATUS = 2 ERR_STATUS = 3 GLOBAL_NORMAL_STATUS = 0 GLOBAL_READ_STAUS = 8 )
View Source
const (
HEADERSIZE = 6
)
Variables ¶
View Source
var ( PUT uint8 = 0x00 GET uint8 = 0x01 DELETE uint8 = 0x02 PING uint8 = 0x0A )
View Source
var (
CONN_POOL_CLOSED_ERR = errors.New("connection pool is closed")
)
View Source
var (
FIDS_EMPTY_ERR = fmt.Errorf("fids is empty")
)
Functions ¶
This section is empty.
Types ¶
type ChunkServer ¶
type ChunkServer struct { GroupId int32 Ip string Port int64 Status int8 GlobalStatus int8 TotalFreeSpace int64 MaxFreeSpace int64 PendingWrites int WritingCount int }
func (*ChunkServer) DeleteData ¶
func (cs *ChunkServer) DeleteData(groupId, fileId string, conn *PooledConn) error
func (*ChunkServer) GetData ¶
func (cs *ChunkServer) GetData(miv *meta.MetaInfoValue, conn *PooledConn) ([]byte, error)
func (*ChunkServer) HostInfoEqual ¶
func (csi *ChunkServer) HostInfoEqual(another *ChunkServer) bool
func (*ChunkServer) Ping ¶
func (cs *ChunkServer) Ping(conn *PooledConn) error
func (*ChunkServer) PutData ¶
func (cs *ChunkServer) PutData(data []byte, conn *PooledConn, fileId uint64) error
type ChunkServerConnectionPool ¶
type ChunkServerConnectionPool struct { Pools map[string]*ConnectionPool // <ip:port>:connectionpool // contains filtered or unexported fields }
func NewChunkServerConnectionPool ¶
func NewChunkServerConnectionPool() *ChunkServerConnectionPool
func (*ChunkServerConnectionPool) AddExistPool ¶
func (cscp *ChunkServerConnectionPool) AddExistPool(key string, pool *ConnectionPool)
func (*ChunkServerConnectionPool) AddPool ¶
func (cscp *ChunkServerConnectionPool) AddPool(chunkserver *ChunkServer, capacity int) error
func (*ChunkServerConnectionPool) CheckConnPool ¶
func (cscp *ChunkServerConnectionPool) CheckConnPool(chunkserver *ChunkServer) error
chunkserver closed, the state of connection in pool is close_wait, need to close those connection
func (*ChunkServerConnectionPool) GetConn ¶
func (cscp *ChunkServerConnectionPool) GetConn(chunkserver *ChunkServer) (PoolConnection, error)
func (*ChunkServerConnectionPool) ReleaseConn ¶
func (cscp *ChunkServerConnectionPool) ReleaseConn(pc PoolConnection)
func (*ChunkServerConnectionPool) RemoveAndClosePool ¶
func (cscp *ChunkServerConnectionPool) RemoveAndClosePool(chunkserver *ChunkServer) error
func (*ChunkServerConnectionPool) RemovePool ¶
func (cscp *ChunkServerConnectionPool) RemovePool(chunkserver *ChunkServer)
type ChunkServerGroups ¶
type ChunkServerGroups struct {
GroupMap map[string][]ChunkServer //groupId <> []ChunkServer
}
func (*ChunkServerGroups) GetChunkServerGroup ¶
func (csgs *ChunkServerGroups) GetChunkServerGroup(groupId string) ([]ChunkServer, bool)
func (*ChunkServerGroups) Print ¶
func (csgs *ChunkServerGroups) Print()
type Conn ¶
func NewConnection ¶
type ConnectionPool ¶
type ConnectionPool struct {
// contains filtered or unexported fields
}
func NewConnectionPool ¶
func NewConnectionPool(name string, capacity int, idleTimeout time.Duration) *ConnectionPool
func (*ConnectionPool) Capacity ¶
func (cp *ConnectionPool) Capacity() int64
func (*ConnectionPool) Close ¶
func (cp *ConnectionPool) Close()
Close will close the pool and wait for connections to be returned before exiting
func (*ConnectionPool) Get ¶
func (cp *ConnectionPool) Get() (PoolConnection, error)
func (*ConnectionPool) IdleTimeout ¶
func (cp *ConnectionPool) IdleTimeout() time.Duration
func (*ConnectionPool) MaxCap ¶
func (cp *ConnectionPool) MaxCap() int64
func (*ConnectionPool) Open ¶
func (cp *ConnectionPool) Open(connFactory CreateConnectionFunc)
Open must be cal before starting to use the pool
func (*ConnectionPool) Put ¶
func (cp *ConnectionPool) Put(conn PoolConnection)
func (*ConnectionPool) SetCapacity ¶
func (cp *ConnectionPool) SetCapacity(capacity int) (err error)
func (*ConnectionPool) SetIdleTimeOut ¶
func (cp *ConnectionPool) SetIdleTimeOut(idleTimeout time.Duration)
func (*ConnectionPool) StatsJSON ¶
func (cp *ConnectionPool) StatsJSON() string
func (*ConnectionPool) TryGet ¶
func (cp *ConnectionPool) TryGet() (PoolConnection, error)
func (*ConnectionPool) WaitCount ¶
func (cp *ConnectionPool) WaitCount() int64
func (*ConnectionPool) WaitTime ¶
func (cp *ConnectionPool) WaitTime() time.Duration
type CreateConnectionFunc ¶
type CreateConnectionFunc func(*ConnectionPool) (connection PoolConnection, err error)
CreateConnectionFunc is the factory method to create new connections within the passed ConnectionPool.
func ConnectionCreator ¶
func ConnectionCreator(addr string) CreateConnectionFunc
type Fids ¶
type Fids struct { Start uint64 `json:"FidBegin"` End uint64 `json:"FidEnd"` // contains filtered or unexported fields }
[start, end)
func (*Fids) GetFidWait ¶
func (*Fids) IsShortage ¶
type HeapElement ¶
type MinHeap ¶
type MinHeap struct {
// contains filtered or unexported fields
}
func NewMinHeap ¶
func (*MinHeap) AddElement ¶
func (*MinHeap) BuildMinHeapSecondary ¶
func (h *MinHeap) BuildMinHeapSecondary()
func (*MinHeap) MinHeapifySecondary ¶
type PoolConnection ¶
type PoolConnection interface { Close() IsClosed() bool Recycle() }
type PooledConn ¶
type PooledConn struct { *Conn // contains filtered or unexported fields }
func (*PooledConn) Recycle ¶
func (pc *PooledConn) Recycle()
Click to show internal directories.
Click to hide internal directories.