Documentation ¶
Index ¶
- Constants
- func NewMockStorageService(conf SSConfig, addrs ...string) *service.Service
- type MockClient
- func (c *MockClient) Batch(msgs []*proto.OperationalMessage, mp []*MockParams) (responses []*proto.OperationalMessage, err error)
- func (c *MockClient) BatchCreate(keys [][]byte, value []byte, ttl uint32) []*proto.OperationalMessage
- func (c *MockClient) Close()
- func (c *MockClient) Create(key []byte, value []byte, ttl uint32, mp *MockParams) (context client.IContext, err error)
- func (c *MockClient) Destroy(key []byte, mp *MockParams) error
- func (c *MockClient) Get(key []byte, mp *MockParams) (value []byte, context client.IContext, err error)
- func (c *MockClient) NewRequest(op proto.OpCode, key []byte, value []byte, ttl uint32) (request *proto.OperationalMessage)
- func (c *MockClient) ReSetMockInfo()
- func (c *MockClient) ResetClient(ns string)
- func (c *MockClient) Set(key []byte, value []byte, ttl uint32, mp *MockParams) (client.IContext, error)
- func (c *MockClient) SetMockInfo(conn net.Conn, m *MockInfo) bool
- func (c *MockClient) Update(key []byte, value []byte, ttl uint32, mp *MockParams) (client.IContext, error)
- type MockInfo
- type MockParams
- func (m *MockParams) Decode(value *bytes.Buffer) error
- func (m *MockParams) Encode() (*bytes.Buffer, error)
- func (m *MockParams) Log(t *testing.T)
- func (m *MockParams) Reset(numss uint8)
- func (m *MockParams) SetOpCodeForAll(code OpCode)
- func (m *MockParams) SetStatus(status ...uint8)
- func (m *MockParams) SetStatusForAll(status uint8)
- func (m *MockParams) SetValue(values ...[]byte)
- func (m *MockParams) SetValueForAll(value []byte)
- func (m *MockParams) SetVersion(versions ...uint32)
- func (m *MockParams) SetVersionForAll(version uint32)
- type RequestHandler
- func (rh *RequestHandler) Finish()
- func (rh *RequestHandler) GetReqCtxCreator() io.InboundRequestContextCreator
- func (rh *RequestHandler) Init()
- func (rh *RequestHandler) OnKeepAlive(connector *io.Connector, reqCtx io.IRequestContext) (err error)
- func (rh *RequestHandler) Process(reqCtx io.IRequestContext) error
- func (rh *RequestHandler) ReadAndProcessRequest(magic []byte, c *io.Connector) error
- type SSConfig
Constants ¶
View Source
const ( DEF_OPCODE = OpCodeNop DEF_STATUS = uint8(OpStatusNoError) DEF_DELAY = 0 DEF_VER = 1 DEF_NORESPONSE = false DEF_SAVE = false DEF_NS = "ns" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type MockClient ¶
type MockClient struct {
// contains filtered or unexported fields
}
func NewMockClient ¶
func NewMockClient(ssconnInfo [][]string, conf client.Config) *MockClient
func (*MockClient) Batch ¶
func (c *MockClient) Batch(msgs []*proto.OperationalMessage, mp []*MockParams) (responses []*proto.OperationalMessage, err error)
func (*MockClient) BatchCreate ¶
func (c *MockClient) BatchCreate(keys [][]byte, value []byte, ttl uint32) []*proto.OperationalMessage
func (*MockClient) Close ¶
func (c *MockClient) Close()
func (*MockClient) Create ¶
func (c *MockClient) Create(key []byte, value []byte, ttl uint32, mp *MockParams) (context client.IContext, err error)
func (*MockClient) Destroy ¶
func (c *MockClient) Destroy(key []byte, mp *MockParams) error
func (*MockClient) Get ¶
func (c *MockClient) Get(key []byte, mp *MockParams) (value []byte, context client.IContext, err error)
func (*MockClient) NewRequest ¶
func (c *MockClient) NewRequest(op proto.OpCode, key []byte, value []byte, ttl uint32) (request *proto.OperationalMessage)
func (*MockClient) ReSetMockInfo ¶
func (c *MockClient) ReSetMockInfo()
func (*MockClient) ResetClient ¶
func (c *MockClient) ResetClient(ns string)
func (*MockClient) Set ¶
func (c *MockClient) Set(key []byte, value []byte, ttl uint32, mp *MockParams) (client.IContext, error)
func (*MockClient) SetMockInfo ¶
func (c *MockClient) SetMockInfo(conn net.Conn, m *MockInfo) bool
func (*MockClient) Update ¶
func (c *MockClient) Update(key []byte, value []byte, ttl uint32, mp *MockParams) (client.IContext, error)
type MockInfo ¶
type MockInfo struct { Namespace string Opcode OpCode Status uint8 Delay uint32 Version uint32 NoResponse bool Save bool Value []byte // expected value if set CreationTime uint32 }
Mock specification for one storage server if opcode is set to OpCodeNop, it will apply to all opcode; otherwise apply to specific opcode
func NewMockInfo ¶
func NewMockInfo() *MockInfo
func (*MockInfo) GetStatusText ¶
type MockParams ¶
Mock spec for a group of storage servers (in different rack)
func NewMockParams ¶
func NewMockParams(numss uint8) *MockParams
func (*MockParams) Log ¶
func (m *MockParams) Log(t *testing.T)
func (*MockParams) Reset ¶
func (m *MockParams) Reset(numss uint8)
func (*MockParams) SetOpCodeForAll ¶
func (m *MockParams) SetOpCodeForAll(code OpCode)
func (*MockParams) SetStatus ¶
func (m *MockParams) SetStatus(status ...uint8)
func (*MockParams) SetStatusForAll ¶
func (m *MockParams) SetStatusForAll(status uint8)
func (*MockParams) SetValue ¶
func (m *MockParams) SetValue(values ...[]byte)
func (*MockParams) SetValueForAll ¶
func (m *MockParams) SetValueForAll(value []byte)
func (*MockParams) SetVersion ¶
func (m *MockParams) SetVersion(versions ...uint32)
func (*MockParams) SetVersionForAll ¶
func (m *MockParams) SetVersionForAll(version uint32)
type RequestHandler ¶
type RequestHandler struct {
// contains filtered or unexported fields
}
func NewRequestHandler ¶
func NewRequestHandler(conf *SSConfig) *RequestHandler
func (*RequestHandler) Finish ¶
func (rh *RequestHandler) Finish()
func (*RequestHandler) GetReqCtxCreator ¶
func (rh *RequestHandler) GetReqCtxCreator() io.InboundRequestContextCreator
func (*RequestHandler) Init ¶
func (rh *RequestHandler) Init()
func (*RequestHandler) OnKeepAlive ¶
func (rh *RequestHandler) OnKeepAlive(connector *io.Connector, reqCtx io.IRequestContext) (err error)
func (*RequestHandler) Process ¶
func (rh *RequestHandler) Process(reqCtx io.IRequestContext) error
func (*RequestHandler) ReadAndProcessRequest ¶
func (rh *RequestHandler) ReadAndProcessRequest(magic []byte, c *io.Connector) error
type SSConfig ¶
type SSConfig struct { service.Config MeanDelay int StdDevDelay int ValueSize int StdDevSize int Inbound io.InboundConfig LogLevel string }
var ( DefaultSSConfig SSConfig = SSConfig{ MeanDelay: 0, StdDevDelay: 0, ValueSize: 1024, StdDevSize: 100, Inbound: io.InboundConfig{ IdleTimeout: util.Duration{math.MaxUint32 * time.Second}, ReadTimeout: util.Duration{math.MaxUint32 * time.Millisecond}, WriteTimeout: util.Duration{math.MaxUint32 * time.Millisecond}, RequestTimeout: util.Duration{600 * time.Millisecond}, }, LogLevel: "warning", } )
Click to show internal directories.
Click to hide internal directories.