mock

package
v0.0.0-...-d1cd037 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 5, 2017 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewMetrics

func NewMetrics() *jocko.Metrics

Types

type Broker

type Broker struct {
	RunFn           func(context.Context, <-chan jocko.Request, chan<- jocko.Response)
	RunInvoked      bool
	JoinFn          func(addr ...string) protocol.Error
	JoinInvoked     bool
	ShutdownFn      func() error
	ShutdownInvoked bool
}

func (*Broker) Join

func (b *Broker) Join(addr ...string) protocol.Error

func (*Broker) Run

func (b *Broker) Run(ctx context.Context, requests <-chan jocko.Request, responses chan<- jocko.Response)

func (*Broker) Shutdown

func (b *Broker) Shutdown() error

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client for testing

func NewClient

func NewClient(msgCount int) *Client

NewClient is a client that fetches given number of msgs

func (*Client) CreateTopic

func (p *Client) CreateTopic(clientID string, createRequest *protocol.CreateTopicRequest) (*protocol.CreateTopicsResponse, error)

func (*Client) FetchMessages

func (p *Client) FetchMessages(clientID string, fetchRequest *protocol.FetchRequest) (*protocol.FetchResponses, error)

func (*Client) Messages

func (p *Client) Messages() [][]byte

type CommitLog

type CommitLog struct {
	// contains filtered or unexported fields
}

func NewCommitLog

func NewCommitLog() *CommitLog

func (*CommitLog) Append

func (c *CommitLog) Append(b []byte) (int64, error)

func (*CommitLog) Delete

func (c *CommitLog) Delete() error

func (*CommitLog) Log

func (c *CommitLog) Log() [][]byte

func (*CommitLog) NewReader

func (c *CommitLog) NewReader(offset int64, maxBytes int32) (io.Reader, error)

func (*CommitLog) NewestOffset

func (c *CommitLog) NewestOffset() int64

func (*CommitLog) OldestOffset

func (c *CommitLog) OldestOffset() int64

func (*CommitLog) Truncate

func (c *CommitLog) Truncate(int64) error

type Raft

type Raft struct {
	BootstrapFn      func(serf jocko.Serf, serfEventCh <-chan *jocko.ClusterMember, commandCh chan<- jocko.RaftCommand) error
	BootstrapInvoked bool
	ApplyFn          func(cmd jocko.RaftCommand) error
	ApplyInvoked     bool
	IsLeaderFn       func() bool
	IsLeaderInvoked  bool
	LeaderIDFn       func() string
	LeaderIDInvoked  bool
	ShutdownFn       func() error
	ShutdownInvoked  bool
	AddrFn           func() string
	AddrInvoked      bool
}

func (*Raft) Addr

func (r *Raft) Addr() string

func (*Raft) Apply

func (r *Raft) Apply(cmd jocko.RaftCommand) error

func (*Raft) Bootstrap

func (r *Raft) Bootstrap(serf jocko.Serf, serfEventCh <-chan *jocko.ClusterMember, commandCh chan<- jocko.RaftCommand) error

func (*Raft) IsLeader

func (r *Raft) IsLeader() bool

func (*Raft) LeaderID

func (r *Raft) LeaderID() string

func (*Raft) Shutdown

func (r *Raft) Shutdown() error

type Serf

type Serf struct {
	BootstrapFn      func(node *jocko.ClusterMember, reconcileCh chan<- *jocko.ClusterMember) error
	BootstrapInvoked bool
	ClusterFn        func() []*jocko.ClusterMember
	ClusterInvoked   bool
	MemberFn         func(memberID int32) *jocko.ClusterMember
	MemberInvoked    bool
	JoinFn           func(addrs ...string) (int, error)
	JoinInvoked      bool
	ShutdownFn       func() error
	ShutdownInvoked  bool
	IDFn             func() int32
	IDInvoked        bool
}

func (*Serf) Bootstrap

func (s *Serf) Bootstrap(node *jocko.ClusterMember, reconcileCh chan<- *jocko.ClusterMember) error

func (*Serf) Cluster

func (s *Serf) Cluster() []*jocko.ClusterMember

func (*Serf) ID

func (s *Serf) ID() int32

func (*Serf) Join

func (s *Serf) Join(addrs ...string) (int, error)

func (*Serf) Member

func (s *Serf) Member(memberID int32) *jocko.ClusterMember

func (*Serf) Shutdown

func (s *Serf) Shutdown() error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL