core

package
v0.0.0-...-d89597d Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2020 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	InvokeOperation = "call"
	ReturnOperation = "return"
)

Operation action

Variables

This section is empty.

Functions

func RunE2ETests

func RunE2ETests(t *testing.T)

RunE2ETests checks configuration parameters (specified through flags) and then runs E2E tests using the Ginkgo runner. If a "report directory" is specified, one or more JUnit test reports will be generated in this directory, and cluster logs will also be saved. This function is called on each Ginkgo node in parallel mode.

Types

type Checker

type Checker interface {
	// Check a series of operations with the given model.
	// Return false or error if operations do not satisfy the model.
	Check(m Model, ops []Operation) (bool, error)

	// Name returns the unique name for the checker.
	Name() string
}

Checker checks a history of operations.

type Client

type Client interface {
	// SetUp sets up the client.
	SetUp(ctx context.Context, nodes []string, node string) error
	// TearDown tears down the client.
	TearDown(ctx context.Context, nodes []string, node string) error
	// Invoke invokes a request to the database.
	// Mostly, the return Response should implement UnknownResponse interface
	Invoke(ctx context.Context, node string, r interface{}) interface{}
	// NextRequest generates a request for latter Invoke.
	NextRequest() interface{}
	// DumpState the database state(also the model's state)
	DumpState(ctx context.Context) (interface{}, error)
}

Client applies the request to the database. Client is used in control. You should define your own client for your database.

type ClientCreator

type ClientCreator interface {
	// Create creates the client.
	Create(node string) Client
}

ClientCreator creates a client. The control will create one client for one node.

type Model

type Model interface {
	// Prepare the initial state of the data object.
	Prepare(state interface{})

	// Initial state of the data object.
	Init() interface{}

	// Step function for the data object. Returns whether or not the system
	// could take this step with the given inputs and outputs and also
	// returns the new state. This should not mutate the existing state.
	//
	// state must support encoding to and decoding from json.
	Step(state interface{}, input interface{}, output interface{}) (bool, interface{})

	// Equality on states.
	Equal(state1, state2 interface{}) bool

	// Name returns the unique name for the model.
	Name() string
}

Model specifies the behavior of a data object.

type NoopChecker

type NoopChecker struct{}

NoopChecker is a noop checker.

func (NoopChecker) Check

func (NoopChecker) Check(m Model, ops []Operation) (bool, error)

Check impls Checker.

func (NoopChecker) Name

func (NoopChecker) Name() string

Name impls Checker.

type NoopClientCreator

type NoopClientCreator struct {
}

NoopClientCreator creates a noop client.

func (NoopClientCreator) Create

func (NoopClientCreator) Create(node string) Client

Create creates the client.

type NoopModel

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

NoopModel is noop model.

func (*NoopModel) Equal

func (*NoopModel) Equal(state1, state2 interface{}) bool

Equal returns equality on states.

func (*NoopModel) Init

func (n *NoopModel) Init() interface{}

Init initials state of the data object.

func (*NoopModel) Name

func (*NoopModel) Name() string

Name returns the unique name for the model.

func (*NoopModel) Prepare

func (n *NoopModel) Prepare(state interface{})

Prepare the initial state of the data object.

func (*NoopModel) Step

func (*NoopModel) Step(state interface{}, input interface{}, output interface{}) (bool, interface{})

Step function for the data object.

type Operation

type Operation struct {
	Action string      `json:"action"`
	Proc   int64       `json:"proc"`
	Data   interface{} `json:"data"`
}

Operation of a data object.

type UnknownResponse

type UnknownResponse interface {
	IsUnknown() bool
}

UnknownResponse means we don't know weather this operation succeeds or not.

Jump to

Keyboard shortcuts

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