node

package
v0.0.0-...-2eec6a9 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2017 License: LGPL-3.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// HTTPPathPrefix path prefix
	HTTPPathPrefix = "/node/"
)

Variables

This section is empty.

Functions

func NewHTTPHandler

func NewHTTPHandler(node *Node) http.Handler

NewHTTPHandler create http handler to expose operations to local node

Types

type InviteRequest

type InviteRequest struct {
	InitSpec *spec.Spec `json:"initSpec"`
}

InviteRequest request body struct for invitation

type InviteResponse

type InviteResponse struct {
	NodeID string `json:"nodeID"`
}

InviteResponse response body struct for invitation

type Node

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

Node defines local node of solidb.

func New

func New(store kv.Store, specMgr *specmgr.SpecManager) (*Node, error)

New creates node instance

func (*Node) ApproveSpec

func (n *Node) ApproveSpec(revision int) error

ApproveSpec approve spec by revision. The spec to be approved should be synced.

func (*Node) ClusterID

func (n *Node) ClusterID() string

ClusterID returns cluster ID the node belongs to.

func (*Node) GetStatus

func (n *Node) GetStatus() (*StatusResponse, error)

GetStatus returns node status.

func (*Node) GetSyncStatus

func (n *Node) GetSyncStatus(revision int) (*SyncStatusResponse, error)

GetSyncStatus returns progress of slice syncing

func (*Node) ID

func (n *Node) ID() string

ID returns ID of node.

func (*Node) Invite

func (n *Node) Invite(clusterID string, initSpec *spec.Spec) error

Invite invite the node to join a cluster.

func (*Node) ProposeSpec

func (n *Node) ProposeSpec(s spec.Spec) error

ProposeSpec propose a new spec. The revision of proposed one should be >= newest.

func (*Node) RequestSync

func (n *Node) RequestSync(revision int) error

RequestSync request to sync slices according to spec specified by revision.

func (*Node) Shutdown

func (n *Node) Shutdown()

Shutdown terminate running node and block until stopped.

func (*Node) Start

func (n *Node) Start()

Start start running node

type PutBlobResponse

type PutBlobResponse struct {
	Key blob.Key `json:"key"`
}

PutBlobResponse response body struct for put blob

type RPC

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

func NewRPC

func NewRPC() *RPC

func (*RPC) ApproveSpec

func (rpc *RPC) ApproveSpec(revision int) error

func (*RPC) GetBlob

func (rpc *RPC) GetBlob(blobKey blob.Key) (*blobio.OptBlob, error)

func (*RPC) GetBlobSlice

func (rpc *RPC) GetBlobSlice(prefix string) (io.ReadCloser, error)

func (*RPC) GetStatus

func (rpc *RPC) GetStatus() (*StatusResponse, error)

func (*RPC) GetSyncStatus

func (rpc *RPC) GetSyncStatus(revision int) (*SyncStatusResponse, error)

func (*RPC) Invite

func (rpc *RPC) Invite(initSpec *spec.Spec) (nodeID string, err error)

func (*RPC) ProposeSpec

func (rpc *RPC) ProposeSpec(s spec.Spec) error

func (*RPC) PutBlob

func (rpc *RPC) PutBlob(blob *blob.Blob) error

func (*RPC) SyncToSpec

func (rpc *RPC) SyncToSpec(revision int) error

func (*RPC) WithAddr

func (rpc *RPC) WithAddr(addr string) *RPC

func (*RPC) WithContext

func (rpc *RPC) WithContext(ctx context.Context) *RPC

func (*RPC) WithIdentity

func (rpc *RPC) WithIdentity(identity *crypto.Identity, targetID string) *RPC

type Revisions

type Revisions struct {
	Newest   int `json:"newest"`
	Synced   int `json:"synced"`
	Approved int `json:"approved"`
}

Revisions gather all types of revision

type StatusResponse

type StatusResponse struct {
	NodeID        string    `json:"nodeID"`
	ClusterID     string    `json:"clusterID"`
	SpecRevisions Revisions `json:"specRevisions"`
}

StatusResponse status of node

type SyncStatusResponse

type SyncStatusResponse struct {
	SyncedSliceCount int
	TotalSliceCount  int
}

SyncStatusResponse sync status

Directories

Path Synopsis
Package syncstate provides functions to maintain sync state
Package syncstate provides functions to maintain sync state

Jump to

Keyboard shortcuts

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