Documentation ¶
Index ¶
- func NewMockResult(sid string) *common.CommandResult
- type Broadcaster
- type Broker
- func (_m *Broker) Announce() string
- func (_m *Broker) CommitSession(sid string, session broker.Cacheable) error
- func (_m *Broker) FinishSession(sid string) error
- func (_m *Broker) HandleBroadcast(msg *common.StreamMessage)
- func (_m *Broker) HandleCommand(msg *common.RemoteCommandMessage)
- func (_m *Broker) HistoryFrom(stream string, epoch string, offset uint64) ([]common.StreamMessage, error)
- func (_m *Broker) HistorySince(stream string, ts int64) ([]common.StreamMessage, error)
- func (_m *Broker) RestoreSession(from string) ([]byte, error)
- func (_m *Broker) Shutdown() error
- func (_m *Broker) Start() error
- func (_m *Broker) Subscribe(stream string) string
- func (_m *Broker) Unsubscribe(stream string) string
- type Controller
- func (_m *Controller) Authenticate(sid string, env *common.SessionEnv) (*common.ConnectResult, error)
- func (_m *Controller) Disconnect(sid string, env *common.SessionEnv, id string, subscriptions []string) error
- func (_m *Controller) Perform(sid string, env *common.SessionEnv, id string, channel string, data string) (*common.CommandResult, error)
- func (_m *Controller) Shutdown() error
- func (_m *Controller) Start() error
- func (_m *Controller) Subscribe(sid string, env *common.SessionEnv, id string, channel string) (*common.CommandResult, error)
- func (_m *Controller) Unsubscribe(sid string, env *common.SessionEnv, id string, channel string) (*common.CommandResult, error)
- type Handler
- type Identifier
- type Instrumenter
- func (_m *Instrumenter) CounterAdd(name string, val uint64)
- func (_m *Instrumenter) CounterIncrement(name string)
- func (_m *Instrumenter) GaugeDecrement(name string)
- func (_m *Instrumenter) GaugeIncrement(name string)
- func (_m *Instrumenter) GaugeSet(name string, val uint64)
- func (_m *Instrumenter) RegisterCounter(name string, desc string)
- func (_m *Instrumenter) RegisterGauge(name string, desc string)
- type MockConnection
- func (conn MockConnection) Close(_code int, _reason string)
- func (conn MockConnection) Descriptor() net.Conn
- func (conn MockConnection) Read() ([]byte, error)
- func (conn MockConnection) ReadIndifinitely() []byte
- func (conn MockConnection) Write(msg []byte, deadline time.Time) error
- func (conn MockConnection) WriteBinary(msg []byte, deadline time.Time) error
- type MockController
- func (c *MockController) Authenticate(sid string, env *common.SessionEnv) (*common.ConnectResult, error)
- func (c *MockController) Disconnect(sid string, env *common.SessionEnv, id string, subscriptions []string) error
- func (c *MockController) Perform(sid string, env *common.SessionEnv, id string, channel string, data string) (*common.CommandResult, error)
- func (c *MockController) Shutdown() error
- func (c *MockController) Start() error
- func (c *MockController) Subscribe(sid string, env *common.SessionEnv, id string, channel string) (*common.CommandResult, error)
- func (c *MockController) Unsubscribe(sid string, env *common.SessionEnv, id string, channel string) (*common.CommandResult, error)
- type RPCClient
- func (_m *RPCClient) Command(ctx context.Context, in *anycable.CommandMessage, opts ...grpc.CallOption) (*anycable.CommandResponse, error)
- func (_m *RPCClient) Connect(ctx context.Context, in *anycable.ConnectionRequest, opts ...grpc.CallOption) (*anycable.ConnectionResponse, error)
- func (_m *RPCClient) Disconnect(ctx context.Context, in *anycable.DisconnectRequest, opts ...grpc.CallOption) (*anycable.DisconnectResponse, error)
- type RPCServer
- func (_m *RPCServer) Command(_a0 context.Context, _a1 *anycable.CommandMessage) (*anycable.CommandResponse, error)
- func (_m *RPCServer) Connect(_a0 context.Context, _a1 *anycable.ConnectionRequest) (*anycable.ConnectionResponse, error)
- func (_m *RPCServer) Disconnect(_a0 context.Context, _a1 *anycable.DisconnectRequest) (*anycable.DisconnectResponse, error)
- type Subscriber
- func (_m *Subscriber) Broadcast(msg *common.StreamMessage)
- func (_m *Subscriber) BroadcastCommand(msg *common.RemoteCommandMessage)
- func (_m *Subscriber) IsMultiNode() bool
- func (_m *Subscriber) Shutdown() error
- func (_m *Subscriber) Start(done chan error) error
- func (_m *Subscriber) Subscribe(stream string)
- func (_m *Subscriber) Unsubscribe(stream string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewMockResult ¶
func NewMockResult(sid string) *common.CommandResult
NewMockResult builds a new result with sid as transmission
Types ¶
type Broadcaster ¶ added in v1.4.0
Broadcaster is an autogenerated mock type for the Broadcaster type
func NewBroadcaster ¶ added in v1.4.0
func NewBroadcaster(t mockConstructorTestingTNewBroadcaster) *Broadcaster
NewBroadcaster creates a new instance of Broadcaster. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
func (*Broadcaster) IsFanout ¶ added in v1.4.0
func (_m *Broadcaster) IsFanout() bool
IsFanout provides a mock function with given fields:
func (*Broadcaster) Shutdown ¶ added in v1.4.0
func (_m *Broadcaster) Shutdown() error
Shutdown provides a mock function with given fields:
func (*Broadcaster) Start ¶ added in v1.4.0
func (_m *Broadcaster) Start(done chan error) error
Start provides a mock function with given fields: done
type Broker ¶ added in v1.4.0
Broker is an autogenerated mock type for the Broker type
func NewBroker ¶ added in v1.4.0
func NewBroker(t mockConstructorTestingTNewBroker) *Broker
NewBroker creates a new instance of Broker. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
func (*Broker) CommitSession ¶ added in v1.4.0
CommitSession provides a mock function with given fields: sid, session
func (*Broker) FinishSession ¶ added in v1.4.0
FinishSession provides a mock function with given fields: sid
func (*Broker) HandleBroadcast ¶ added in v1.4.0
func (_m *Broker) HandleBroadcast(msg *common.StreamMessage)
HandleBroadcast provides a mock function with given fields: msg
func (*Broker) HandleCommand ¶ added in v1.4.0
func (_m *Broker) HandleCommand(msg *common.RemoteCommandMessage)
HandleCommand provides a mock function with given fields: msg
func (*Broker) HistoryFrom ¶ added in v1.4.0
func (_m *Broker) HistoryFrom(stream string, epoch string, offset uint64) ([]common.StreamMessage, error)
HistoryFrom provides a mock function with given fields: stream, epoch, offset
func (*Broker) HistorySince ¶ added in v1.4.0
HistorySince provides a mock function with given fields: stream, ts
func (*Broker) RestoreSession ¶ added in v1.4.0
RestoreSession provides a mock function with given fields: from
func (*Broker) Subscribe ¶ added in v1.4.0
Subscribe provides a mock function with given fields: stream
func (*Broker) Unsubscribe ¶ added in v1.4.0
Unsubscribe provides a mock function with given fields: stream
type Controller ¶ added in v1.2.0
Controller is an autogenerated mock type for the Controller type
func (*Controller) Authenticate ¶ added in v1.2.0
func (_m *Controller) Authenticate(sid string, env *common.SessionEnv) (*common.ConnectResult, error)
Authenticate provides a mock function with given fields: sid, env
func (*Controller) Disconnect ¶ added in v1.2.0
func (_m *Controller) Disconnect(sid string, env *common.SessionEnv, id string, subscriptions []string) error
Disconnect provides a mock function with given fields: sid, env, id, subscriptions
func (*Controller) Perform ¶ added in v1.2.0
func (_m *Controller) Perform(sid string, env *common.SessionEnv, id string, channel string, data string) (*common.CommandResult, error)
Perform provides a mock function with given fields: sid, env, id, channel, data
func (*Controller) Shutdown ¶ added in v1.2.0
func (_m *Controller) Shutdown() error
Shutdown provides a mock function with given fields:
func (*Controller) Start ¶ added in v1.2.0
func (_m *Controller) Start() error
Start provides a mock function with given fields:
func (*Controller) Subscribe ¶ added in v1.2.0
func (_m *Controller) Subscribe(sid string, env *common.SessionEnv, id string, channel string) (*common.CommandResult, error)
Subscribe provides a mock function with given fields: sid, env, id, channel
func (*Controller) Unsubscribe ¶ added in v1.2.0
func (_m *Controller) Unsubscribe(sid string, env *common.SessionEnv, id string, channel string) (*common.CommandResult, error)
Unsubscribe provides a mock function with given fields: sid, env, id, channel
type Handler ¶ added in v1.1.4
Handler is an autogenerated mock type for the Handler type
func NewHandler ¶ added in v1.4.0
func NewHandler(t mockConstructorTestingTNewHandler) *Handler
NewHandler creates a new instance of Handler. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
func (*Handler) HandleBroadcast ¶ added in v1.4.0
HandleBroadcast provides a mock function with given fields: json
func (*Handler) HandlePubSub ¶ added in v1.1.4
HandlePubSub provides a mock function with given fields: json
type Identifier ¶ added in v1.2.0
Identifier is an autogenerated mock type for the Identifier type
func NewIdentifier ¶ added in v1.4.0
func NewIdentifier(t mockConstructorTestingTNewIdentifier) *Identifier
NewIdentifier creates a new instance of Identifier. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
func (*Identifier) Identify ¶ added in v1.2.0
func (_m *Identifier) Identify(sid string, env *common.SessionEnv) (*common.ConnectResult, error)
Identify provides a mock function with given fields: sid, env
type Instrumenter ¶ added in v1.4.0
Instrumenter is an autogenerated mock type for the Instrumenter type
func NewInstrumenter ¶ added in v1.4.0
func NewInstrumenter(t mockConstructorTestingTNewInstrumenter) *Instrumenter
NewInstrumenter creates a new instance of Instrumenter. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
func (*Instrumenter) CounterAdd ¶ added in v1.4.0
func (_m *Instrumenter) CounterAdd(name string, val uint64)
CounterAdd provides a mock function with given fields: name, val
func (*Instrumenter) CounterIncrement ¶ added in v1.4.0
func (_m *Instrumenter) CounterIncrement(name string)
CounterIncrement provides a mock function with given fields: name
func (*Instrumenter) GaugeDecrement ¶ added in v1.4.0
func (_m *Instrumenter) GaugeDecrement(name string)
GaugeDecrement provides a mock function with given fields: name
func (*Instrumenter) GaugeIncrement ¶ added in v1.4.0
func (_m *Instrumenter) GaugeIncrement(name string)
GaugeIncrement provides a mock function with given fields: name
func (*Instrumenter) GaugeSet ¶ added in v1.4.0
func (_m *Instrumenter) GaugeSet(name string, val uint64)
GaugeSet provides a mock function with given fields: name, val
func (*Instrumenter) RegisterCounter ¶ added in v1.4.0
func (_m *Instrumenter) RegisterCounter(name string, desc string)
RegisterCounter provides a mock function with given fields: name, desc
func (*Instrumenter) RegisterGauge ¶ added in v1.4.0
func (_m *Instrumenter) RegisterGauge(name string, desc string)
RegisterGauge provides a mock function with given fields: name, desc
type MockConnection ¶ added in v1.4.0
type MockConnection struct {
// contains filtered or unexported fields
}
func NewMockConnection ¶ added in v1.4.0
func NewMockConnection() MockConnection
func (MockConnection) Close ¶ added in v1.4.0
func (conn MockConnection) Close(_code int, _reason string)
func (MockConnection) Descriptor ¶ added in v1.4.0
func (conn MockConnection) Descriptor() net.Conn
func (MockConnection) Read ¶ added in v1.4.0
func (conn MockConnection) Read() ([]byte, error)
func (MockConnection) ReadIndifinitely ¶ added in v1.4.0
func (conn MockConnection) ReadIndifinitely() []byte
func (MockConnection) Write ¶ added in v1.4.0
func (conn MockConnection) Write(msg []byte, deadline time.Time) error
func (MockConnection) WriteBinary ¶ added in v1.4.0
func (conn MockConnection) WriteBinary(msg []byte, deadline time.Time) error
type MockController ¶
type MockController struct {
Started bool
}
MockController implements controller interface for tests
func NewMockController ¶
func NewMockController() MockController
NewMockController builds new mock controller instance
func (*MockController) Authenticate ¶
func (c *MockController) Authenticate(sid string, env *common.SessionEnv) (*common.ConnectResult, error)
Authenticate emulates authentication process: - if path is equal to "failure" then authentication failed - otherwise returns value of headers['id'] as identifier
func (*MockController) Disconnect ¶
func (c *MockController) Disconnect(sid string, env *common.SessionEnv, id string, subscriptions []string) error
Disconnect method stub
func (*MockController) Perform ¶
func (c *MockController) Perform(sid string, env *common.SessionEnv, id string, channel string, data string) (*common.CommandResult, error)
Perform return result with Transmissions containing data (i.e. emulates "echo" action)
func (*MockController) Shutdown ¶
func (c *MockController) Shutdown() error
Shutdown changes Started to false
func (*MockController) Start ¶ added in v1.1.0
func (c *MockController) Start() error
func (*MockController) Subscribe ¶
func (c *MockController) Subscribe(sid string, env *common.SessionEnv, id string, channel string) (*common.CommandResult, error)
Subscribe emulates subscription process: - if channel is equal to "failure" then returns subscription error - if channel is equal to "disconnect" then returns result with disconnect set to true - if channel is equal to "stream" then add "stream" to result.Streams - otherwise returns success result with one transmission equal to sid
func (*MockController) Unsubscribe ¶
func (c *MockController) Unsubscribe(sid string, env *common.SessionEnv, id string, channel string) (*common.CommandResult, error)
Unsubscribe returns command result
type RPCClient ¶
RPCClient is an autogenerated mock type for the RPCClient type
func (*RPCClient) Command ¶
func (_m *RPCClient) Command(ctx context.Context, in *anycable.CommandMessage, opts ...grpc.CallOption) (*anycable.CommandResponse, error)
Command provides a mock function with given fields: ctx, in, opts
func (*RPCClient) Connect ¶
func (_m *RPCClient) Connect(ctx context.Context, in *anycable.ConnectionRequest, opts ...grpc.CallOption) (*anycable.ConnectionResponse, error)
Connect provides a mock function with given fields: ctx, in, opts
func (*RPCClient) Disconnect ¶
func (_m *RPCClient) Disconnect(ctx context.Context, in *anycable.DisconnectRequest, opts ...grpc.CallOption) (*anycable.DisconnectResponse, error)
Disconnect provides a mock function with given fields: ctx, in, opts
type RPCServer ¶ added in v1.4.0
RPCServer is an autogenerated mock type for the RPCServer type
func (*RPCServer) Command ¶ added in v1.4.0
func (_m *RPCServer) Command(_a0 context.Context, _a1 *anycable.CommandMessage) (*anycable.CommandResponse, error)
Command provides a mock function with given fields: _a0, _a1
func (*RPCServer) Connect ¶ added in v1.4.0
func (_m *RPCServer) Connect(_a0 context.Context, _a1 *anycable.ConnectionRequest) (*anycable.ConnectionResponse, error)
Connect provides a mock function with given fields: _a0, _a1
func (*RPCServer) Disconnect ¶ added in v1.4.0
func (_m *RPCServer) Disconnect(_a0 context.Context, _a1 *anycable.DisconnectRequest) (*anycable.DisconnectResponse, error)
Disconnect provides a mock function with given fields: _a0, _a1
type Subscriber ¶ added in v1.4.0
Subscriber is an autogenerated mock type for the Subscriber type
func NewSubscriber ¶ added in v1.4.0
func NewSubscriber(t mockConstructorTestingTNewSubscriber) *Subscriber
NewSubscriber creates a new instance of Subscriber. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
func (*Subscriber) Broadcast ¶ added in v1.4.0
func (_m *Subscriber) Broadcast(msg *common.StreamMessage)
Broadcast provides a mock function with given fields: msg
func (*Subscriber) BroadcastCommand ¶ added in v1.4.0
func (_m *Subscriber) BroadcastCommand(msg *common.RemoteCommandMessage)
BroadcastCommand provides a mock function with given fields: msg
func (*Subscriber) IsMultiNode ¶ added in v1.4.0
func (_m *Subscriber) IsMultiNode() bool
IsMultiNode provides a mock function with given fields:
func (*Subscriber) Shutdown ¶ added in v1.4.0
func (_m *Subscriber) Shutdown() error
Shutdown provides a mock function with given fields:
func (*Subscriber) Start ¶ added in v1.4.0
func (_m *Subscriber) Start(done chan error) error
Start provides a mock function with given fields: done
func (*Subscriber) Subscribe ¶ added in v1.4.0
func (_m *Subscriber) Subscribe(stream string)
Subscribe provides a mock function with given fields: stream
func (*Subscriber) Unsubscribe ¶ added in v1.4.0
func (_m *Subscriber) Unsubscribe(stream string)
Unsubscribe provides a mock function with given fields: stream