fake_node

package
v0.0.0-...-ba27772 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2023 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewBarrier

func NewBarrier(desc string, n int, cb func()) *barrier

Types

type Action

type Action uint8
const (
	Prepare Action = iota
	Activate
	Deactivate
	Drop
)

type ErrKey

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

type TestNode

type TestNode struct {
	Addr string
	Conn *grpc.ClientConn
	// contains filtered or unexported fields
}

func NewTestNode

func NewTestNode(ctx context.Context, addr string, rangeInfos map[api.RangeID]*api.RangeInfo) (*TestNode, func())

func (*TestNode) Activate

func (n *TestNode) Activate(rID api.RangeID) error

func (*TestNode) AddBarrier

func (n *TestNode) AddBarrier(t *testing.T, rID api.RangeID, src api.RemoteState) *barrier

func (*TestNode) Deactivate

func (n *TestNode) Deactivate(rID api.RangeID) error

func (*TestNode) Drop

func (n *TestNode) Drop(rID api.RangeID) error

func (*TestNode) ForceDrop

func (n *TestNode) ForceDrop(rID api.RangeID)

func (*TestNode) GetLoadInfo

func (n *TestNode) GetLoadInfo(rID api.RangeID) (api.LoadInfo, error)

func (*TestNode) Listen

func (n *TestNode) Listen(ctx context.Context, srv *grpc.Server) func()

Rangelet has registered the NodeService by now.

func (*TestNode) Prepare

func (n *TestNode) Prepare(m api.Meta, p []api.Parent) error

func (*TestNode) RPCs

func (n *TestNode) RPCs() []interface{}

RPCs returns a slice of the (proto) requests received by this node since the last time that this method was called, in a deterministic-ish order. This is an ugly hack because asserting that an unordered bunch of protos were all sent is hard.

func (*TestNode) Ranges

func (n *TestNode) Ranges(ctx context.Context, req *pb.RangesRequest) (*pb.RangesResponse, error)

func (*TestNode) SetGracePeriod

func (n *TestNode) SetGracePeriod(d time.Duration)

func (*TestNode) SetReturnValue

func (n *TestNode) SetReturnValue(t *testing.T, rID api.RangeID, act Action, err error)

SetReturnValue sets the value which should be returned from the given action (i.e. one of the state-transitioning methods of the Rangelet interface) for the given range on this test node.

func (*TestNode) SetStrictTransitions

func (n *TestNode) SetStrictTransitions(b bool)

func (*TestNode) SetWantDrain

func (n *TestNode) SetWantDrain(b bool)

Jump to

Keyboard shortcuts

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