session

package
v0.0.0-...-ba0e684 Latest Latest
Warning

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

Go to latest
Published: May 19, 2022 License: Apache-2.0 Imports: 20 Imported by: 19

Documentation

Overview

Code generated by "generator -i=admin.csv > admin_rpc_types.go"; DO NOT EDIT.

Code generated by "generator -i=radmin.csv > radmin_rpc_types.go"; DO NOT EDIT.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterRPCResultHandler

func RegisterRPCResultHandler(responseAck string, handler func() RpcResponseResult)

RegisterRPCResultHandler registers an external RPC that's not including in pegasus-go-client.

The following example registers an response handler for Pegasus's remote-command RPC. Usage:

```go

RegisterRpcResultHandler("RPC_CLI_CLI_CALL_ACK", func() RpcResponseResult {
  return &RemoteCmdServiceCallCommandResult{Success: new(string)}
})

```

func ResolveMetaAddr

func ResolveMetaAddr(addrs []string) ([]string, error)

ResolveMetaAddr into a list of TCP4 addresses. Error is returned if the given `addrs` are not either a list of valid TCP4 addresses, or a resolvable hostname.

Types

type MarshalFunc

type MarshalFunc func(v interface{}) ([]byte, error)

type MetaManager

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

MetaManager manages the list of metas, but only the leader will it request to. If the one is not the actual leader, it will retry with another.

func NewMetaManager

func NewMetaManager(addrs []string, creator NodeSessionCreator) *MetaManager

func (*MetaManager) AddDuplication

AddDuplication is auto-generated

func (*MetaManager) Balance

Balance is auto-generated

func (*MetaManager) ClearBulkLoad

ClearBulkLoad is auto-generated

func (*MetaManager) Close

func (m *MetaManager) Close() error

Close the sessions.

func (*MetaManager) ControlBulkLoad

ControlBulkLoad is auto-generated

func (*MetaManager) ControlPartitionSplit

func (m *MetaManager) ControlPartitionSplit(ctx context.Context, req *admin.ControlSplitRequest) (*admin.ControlSplitResponse, error)

ControlPartitionSplit is auto-generated

func (*MetaManager) CreateApp

CreateApp is auto-generated

func (*MetaManager) DropApp

DropApp is auto-generated

func (*MetaManager) ListApps

ListApps is auto-generated

func (*MetaManager) ListNodes

ListNodes is auto-generated

func (*MetaManager) MetaControl

MetaControl is auto-generated

func (*MetaManager) ModifyDuplication

ModifyDuplication is auto-generated

func (*MetaManager) QueryAppInfo

QueryAppInfo is auto-generated

func (*MetaManager) QueryBackupPolicy

QueryBackupPolicy is auto-generated

func (*MetaManager) QueryBackupStatus

QueryBackupStatus is auto-generated

func (*MetaManager) QueryBulkLoadStatus

func (m *MetaManager) QueryBulkLoadStatus(ctx context.Context, req *admin.QueryBulkLoadRequest) (*admin.QueryBulkLoadResponse, error)

QueryBulkLoadStatus is auto-generated

func (*MetaManager) QueryClusterInfo

QueryClusterInfo is auto-generated

func (*MetaManager) QueryConfig

func (m *MetaManager) QueryConfig(ctx context.Context, tableName string) (*replication.QueryCfgResponse, error)

QueryConfig queries table configuration from the leader of meta servers. If the leader was changed, it retries for other servers until it finds the true leader, unless no leader exists. Thread-Safe

func (*MetaManager) QueryDuplication

QueryDuplication is auto-generated

func (*MetaManager) QueryManualCompact

QueryManualCompact is auto-generated

func (*MetaManager) QuerySplitStatus

func (m *MetaManager) QuerySplitStatus(ctx context.Context, req *admin.QuerySplitRequest) (*admin.QuerySplitResponse, error)

QuerySplitStatus is auto-generated

func (*MetaManager) RecallApp

RecallApp is auto-generated

func (*MetaManager) RestoreApp

RestoreApp is auto-generated

func (*MetaManager) StartBackupApp

StartBackupApp is auto-generated

func (*MetaManager) StartBulkLoad

StartBulkLoad is auto-generated

func (*MetaManager) StartManualCompact

StartManualCompact is auto-generated

func (*MetaManager) StartPartitionSplit

StartPartitionSplit is auto-generated

func (*MetaManager) UpdateAppEnv

UpdateAppEnv is auto-generated

type MockCodec

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

MockCodec is only used for testing. By default it does nothing on marshalling and unmarshalling, thus it returns no error even if the input was ill-formed.

func (*MockCodec) Marshal

func (p *MockCodec) Marshal(v interface{}) ([]byte, error)

func (*MockCodec) MockMarshal

func (p *MockCodec) MockMarshal(marshal MarshalFunc)

func (*MockCodec) MockUnMarshal

func (p *MockCodec) MockUnMarshal(unmarshal UnmarshalFunc)

func (*MockCodec) String

func (p *MockCodec) String() string

func (*MockCodec) Unmarshal

func (p *MockCodec) Unmarshal(data []byte, v interface{}) error

type NodeSession

type NodeSession interface {
	String() string

	// Invoke an rpc call.
	CallWithGpid(ctx context.Context, gpid *base.Gpid, partitionHash uint64, args RpcRequestArgs, name string) (result RpcResponseResult, err error)

	// Get connection state.
	ConnState() rpc.ConnState

	Close() error
}

NodeSession represents the network session to a node (either a meta server or a replica server). It encapsulates the internal rpc processing, including network communication and message (de)serialization.

func NewNodeSession

func NewNodeSession(addr string, ntype NodeType) NodeSession

NewNodeSession always returns a non-nil value even when the connection attempt failed. Each nodeSession corresponds to an RpcConn.

type NodeSessionCreator

type NodeSessionCreator func(string, NodeType) NodeSession

NodeSessionCreator creates an instance of NodeSession, receiving argument `string` as host address, `NodeType` as the type of the node.

type NodeType

type NodeType string

NodeType represents the type of the NodeSession.

const (
	// NodeTypeMeta indicates it's a session to MetaServer.
	NodeTypeMeta NodeType = "meta"

	// NodeTypeReplica indicates it's a session to ReplicaServer.
	NodeTypeReplica NodeType = "replica"

	// LatencyTracingThreshold means RPC's latency higher than the threshold (1000ms) will be traced
	LatencyTracingThreshold = time.Millisecond * 1000
)

type PegasusCodec

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

func NewPegasusCodec

func NewPegasusCodec() *PegasusCodec

func (*PegasusCodec) Marshal

func (p *PegasusCodec) Marshal(v interface{}) ([]byte, error)

func (*PegasusCodec) String

func (p *PegasusCodec) String() string

func (*PegasusCodec) Unmarshal

func (p *PegasusCodec) Unmarshal(data []byte, v interface{}) error

type PegasusRpcCall

type PegasusRpcCall struct {
	Args   RpcRequestArgs
	Result RpcResponseResult
	Name   string // the rpc's name
	SeqId  int32
	Gpid   *base.Gpid

	RawReq []byte // the marshalled request in bytes
	Err    error

	// hooks on each stage during rpc processing
	OnRpcCall time.Time
	OnRpcSend time.Time
	OnRpcRecv time.Time
	// contains filtered or unexported fields
}

func MarshallPegasusRpc

func MarshallPegasusRpc(codec rpc.Codec, seqId int32, gpid *base.Gpid, partitionHash uint64, args RpcRequestArgs, name string, timeout uint32) (*PegasusRpcCall, error)

func ReadRpcResponse

func ReadRpcResponse(conn *rpc.RpcConn, codec rpc.Codec) (*PegasusRpcCall, error)

func (*PegasusRpcCall) TilNow

func (call *PegasusRpcCall) TilNow() time.Duration

func (*PegasusRpcCall) Trace

func (call *PegasusRpcCall) Trace() string

type ReplicaManager

type ReplicaManager struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

ReplicaManager manages the pool of sessions to replica servers, so that different tables that locate on the same replica server can share one ReplicaSession, without the effort of creating a new connection.

func NewReplicaManager

func NewReplicaManager(creator NodeSessionCreator) *ReplicaManager

func (*ReplicaManager) Close

func (rm *ReplicaManager) Close() error

func (*ReplicaManager) GetReplica

func (rm *ReplicaManager) GetReplica(addr string) *ReplicaSession

Create a new session to the replica server if no existing one.

func (*ReplicaManager) ReplicaCount

func (rm *ReplicaManager) ReplicaCount() int

func (*ReplicaManager) SetUnresponsiveHandler

func (rm *ReplicaManager) SetUnresponsiveHandler(handler UnresponsiveHandler)

SetUnresponsiveHandler inits the UnresponsiveHandler.

type ReplicaSession

type ReplicaSession struct {
	NodeSession
}

ReplicaSession represents the network session between client and replica server.

func (*ReplicaSession) AddDisk

AddDisk is auto-generated

func (*ReplicaSession) CheckAndSet

func (rs *ReplicaSession) CheckAndSet(ctx context.Context, gpid *base.Gpid, partitionHash uint64, request *rrdb.CheckAndSetRequest) (*rrdb.CheckAndSetResponse, error)

func (*ReplicaSession) ClearScanner

func (rs *ReplicaSession) ClearScanner(ctx context.Context, gpid *base.Gpid, partitionHash uint64, contextId int64) error

func (*ReplicaSession) Del

func (rs *ReplicaSession) Del(ctx context.Context, gpid *base.Gpid, partitionHash uint64, key *base.Blob) (*rrdb.UpdateResponse, error)

func (*ReplicaSession) DiskMigrate

DiskMigrate is auto-generated

func (*ReplicaSession) Get

func (rs *ReplicaSession) Get(ctx context.Context, gpid *base.Gpid, partitionHash uint64, key *base.Blob) (*rrdb.ReadResponse, error)

func (*ReplicaSession) GetScanner

func (rs *ReplicaSession) GetScanner(ctx context.Context, gpid *base.Gpid, partitionHash uint64, request *rrdb.GetScannerRequest) (*rrdb.ScanResponse, error)

func (*ReplicaSession) Incr

func (rs *ReplicaSession) Incr(ctx context.Context, gpid *base.Gpid, partitionHash uint64, request *rrdb.IncrRequest) (*rrdb.IncrResponse, error)

func (*ReplicaSession) MultiDelete

func (rs *ReplicaSession) MultiDelete(ctx context.Context, gpid *base.Gpid, partitionHash uint64, request *rrdb.MultiRemoveRequest) (*rrdb.MultiRemoveResponse, error)

func (*ReplicaSession) MultiGet

func (rs *ReplicaSession) MultiGet(ctx context.Context, gpid *base.Gpid, partitionHash uint64, request *rrdb.MultiGetRequest) (*rrdb.MultiGetResponse, error)

func (*ReplicaSession) MultiSet

func (rs *ReplicaSession) MultiSet(ctx context.Context, gpid *base.Gpid, partitionHash uint64, request *rrdb.MultiPutRequest) (*rrdb.UpdateResponse, error)

func (*ReplicaSession) Put

func (rs *ReplicaSession) Put(ctx context.Context, gpid *base.Gpid, partitionHash uint64, update *rrdb.UpdateRequest) (*rrdb.UpdateResponse, error)

func (*ReplicaSession) QueryDiskInfo

QueryDiskInfo is auto-generated

func (*ReplicaSession) Scan

func (rs *ReplicaSession) Scan(ctx context.Context, gpid *base.Gpid, partitionHash uint64, request *rrdb.ScanRequest) (*rrdb.ScanResponse, error)

func (*ReplicaSession) SortKeyCount

func (rs *ReplicaSession) SortKeyCount(ctx context.Context, gpid *base.Gpid, partitionHash uint64, hashKey *base.Blob) (*rrdb.CountResponse, error)

func (*ReplicaSession) TTL

func (rs *ReplicaSession) TTL(ctx context.Context, gpid *base.Gpid, partitionHash uint64, key *base.Blob) (*rrdb.TTLResponse, error)

type RpcRequestArgs

type RpcRequestArgs interface {
	String() string
	Write(oprot thrift.TProtocol) error
}

a trait of the thrift-generated argument type (MetaQueryCfgArgs, RrdbPutArgs e.g.)

type RpcResponseResult

type RpcResponseResult interface {
	String() string
	Read(iprot thrift.TProtocol) error
}

a trait of the thrift-generated result type (MetaQueryCfgResult e.g.)

type UnmarshalFunc

type UnmarshalFunc func(data []byte, v interface{}) error

type UnresponsiveHandler

type UnresponsiveHandler func(NodeSession)

UnresponsiveHandler is a callback executed when the session is in unresponsive state.

Jump to

Keyboard shortcuts

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