Documentation ¶
Overview ¶
(C) Copyright 2019 Intel Corporation.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
GOVERNMENT LICENSE RIGHTS-OPEN SOURCE SOFTWARE The Government's rights to use, modify, reproduce, release, perform, display, or disclose this software are subject to the terms of the Apache License as provided in Contract No. 8F-30005. Any reproduction of computer software, computer software documentation, or portions thereof marked with this legend must also reproduce the markings.
Index ¶
- Constants
- Variables
- func Marshal(message proto.Message) ([]byte, error)
- type Call
- func (*Call) Descriptor() ([]byte, []int)
- func (m *Call) GetBody() []byte
- func (m *Call) GetMethod() int32
- func (m *Call) GetModule() int32
- func (m *Call) GetSequence() int64
- func (*Call) ProtoMessage()
- func (m *Call) Reset()
- func (m *Call) String() string
- func (m *Call) XXX_DiscardUnknown()
- func (m *Call) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *Call) XXX_Merge(src proto.Message)
- func (m *Call) XXX_Size() int
- func (m *Call) XXX_Unmarshal(b []byte) error
- type ClientConnection
- type DaosStatus
- type DomainSocketClient
- type DomainSocketServer
- type Failure
- type Module
- type ModuleService
- type Response
- func (*Response) Descriptor() ([]byte, []int)
- func (m *Response) GetBody() []byte
- func (m *Response) GetSequence() int64
- func (m *Response) GetStatus() Status
- func (*Response) ProtoMessage()
- func (m *Response) Reset()
- func (m *Response) String() string
- func (m *Response) XXX_DiscardUnknown()
- func (m *Response) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *Response) XXX_Merge(src proto.Message)
- func (m *Response) XXX_Size() int
- func (m *Response) XXX_Unmarshal(b []byte) error
- type Session
- type Status
Constants ¶
const ( // ModuleSecurityAgent is the dRPC module for security tasks in the // DAOS agent ModuleSecurityAgent = C.DRPC_MODULE_SEC_AGENT // ModuleMgmt is the dRPC module for management service tasks ModuleMgmt = C.DRPC_MODULE_MGMT // ModuleSrv is the dRPC module for tasks relating to server setup ModuleSrv = C.DRPC_MODULE_SRV // ModuleSecurity is the dRPC module for security tasks in the DAOS // server ModuleSecurity = C.DRPC_MODULE_SEC )
const ( // MethodPrepShutdown is a ModuleMgmt method MethodPrepShutdown = C.DRPC_METHOD_MGMT_PREP_SHUTDOWN // MethodPingRank is a ModuleMgmt method MethodPingRank = C.DRPC_METHOD_MGMT_PING_RANK // MethodSetRank is a ModuleMgmt method MethodSetRank = C.DRPC_METHOD_MGMT_SET_RANK // MethodCreateMS is a ModuleMgmt method MethodCreateMS = C.DRPC_METHOD_MGMT_CREATE_MS // MethodStartMS is a ModuleMgmt method MethodStartMS = C.DRPC_METHOD_MGMT_START_MS // MethodJoin is a ModuleMgmt method MethodJoin = C.DRPC_METHOD_MGMT_JOIN // MethodGetAttachInfo is a ModuleMgmt method MethodGetAttachInfo = C.DRPC_METHOD_MGMT_GET_ATTACH_INFO // MethodPoolCreate is a ModuleMgmt method MethodPoolCreate = C.DRPC_METHOD_MGMT_POOL_CREATE // MethodPoolDestroy is a ModuleMgmt method MethodPoolDestroy = C.DRPC_METHOD_MGMT_POOL_DESTROY // MethodBioHealth is a ModuleMgmt method MethodBioHealth = C.DRPC_METHOD_MGMT_BIO_HEALTH_QUERY // MethodSetUp is a ModuleMgmt method MethodSetUp = C.DRPC_METHOD_MGMT_SET_UP // MethodSmdDevs is a ModuleMgmt method MethodSmdDevs = C.DRPC_METHOD_MGMT_SMD_LIST_DEVS // MethodSmdPools is a ModuleMgmt method MethodSmdPools = C.DRPC_METHOD_MGMT_SMD_LIST_POOLS // MethodPoolGetACL is a ModuleMgmt method MethodPoolGetACL = C.DRPC_METHOD_MGMT_POOL_GET_ACL // MethodListPools is a ModuleMgmt method MethodListPools = C.DRPC_METHOD_MGMT_LIST_POOLS // MethodPoolOverwriteACL is a ModuleMgmt method MethodPoolOverwriteACL = C.DRPC_METHOD_MGMT_POOL_OVERWRITE_ACL // MethodPoolUpdateACL is a ModuleMgmt method MethodPoolUpdateACL = C.DRPC_METHOD_MGMT_POOL_UPDATE_ACL // MethodPoolDeleteACL is a ModuleMgmt method MethodPoolDeleteACL = C.DRPC_METHOD_MGMT_POOL_DELETE_ACL // MethodDevStateQuery is a ModuleMgmt method MethodDevStateQuery = C.DRPC_METHOD_MGMT_DEV_STATE_QUERY // MethodSetFaultyState is a ModuleMgmt method MethodSetFaultyState = C.DRPC_METHOD_MGMT_DEV_SET_FAULTY // MethodListContainers is a ModuleMgmt method MethodListContainers = C.DRPC_METHOD_MGMT_LIST_CONTAINERS // MethodPoolQuery defines a method for querying a pool MethodPoolQuery = C.DRPC_METHOD_MGMT_POOL_QUERY // MethodPoolSetProp defines a method for setting a pool property MethodPoolSetProp = C.DRPC_METHOD_MGMT_POOL_SET_PROP )
const ( // MethodNotifyReady is a ModuleSrv method MethodNotifyReady = C.DRPC_METHOD_SRV_NOTIFY_READY // MethodBIOError is a ModuleSrv method MethodBIOError = C.DRPC_METHOD_SRV_BIO_ERR )
const ( // PoolPropertyLabel is a string that a user can associate with a pool. PoolPropertyLabel = C.DAOS_PROP_PO_LABEL // PoolPropertyACL is the Access Control List for a pool. PoolPropertyACL = C.DAOS_PROP_PO_ACL // PoolPropertyReservedSpace is the ratio of space that can be reserved // on each target for rebuild purposes. PoolPropertyReservedSpace = C.DAOS_PROP_PO_SPACE_RB // PoolPropertySelfHealing defines the self-healing behavior of the pool. PoolPropertySelfHealing = C.DAOS_PROP_PO_SELF_HEAL // PoolPropertySpaceReclaim defines the free space reclamation behavior of the pool. PoolPropertySpaceReclaim = C.DAOS_PROP_PO_RECLAIM // PoolPropertyOwner is the user who acts as the owner of the pool. PoolPropertyOwner = C.DAOS_PROP_PO_OWNER // PoolPropertyOwnerGroup is the group that acts as the owner of the pool. PoolPropertyOwnerGroup = C.DAOS_PROP_PO_OWNER_GROUP )
const ( // PoolSpaceReclaimDisabled sets the PoolPropertySpaceReclaim property to disabled. PoolSpaceReclaimDisabled = C.DAOS_RECLAIM_DISABLED // PoolSpaceReclaimLazy sets the PoolPropertySpaceReclaim property to lazy. PoolSpaceReclaimLazy = C.DAOS_RECLAIM_LAZY // PoolSpaceReclaimSnapshot sets the PoolPropertySpaceReclaim property to snapshot. PoolSpaceReclaimSnapshot = C.DAOS_RECLAIM_SNAPSHOT // PoolSpaceReclaimBatch sets the PoolPropertySpaceReclaim property to batch. PoolSpaceReclaimBatch = C.DAOS_RECLAIM_BATCH // PoolSpaceReclaimTime sets the PoolPropertySpaceReclaim property to time. PoolSpaceReclaimTime = C.DAOS_RECLAIM_TIME )
const ( // DaosSuccess indicates no error DaosSuccess DaosStatus = 0 // DaosNoPermission indicates that access to a resource was denied DaosNoPermission = -C.DER_NO_PERM // DaosNoHandle indicates the handle was invalid DaosNoHandle = -C.DER_NO_HDL // DaosInvalidInput indicates an input was invalid DaosInvalidInput = -C.DER_INVAL // DaosExists indicates the entity already exists DaosExists = -C.DER_EXIST // DaosNonexistant indicates the entity does not exist DaosNonexistant = -C.DER_NONEXIST // DaosUnreachable indicates a node was unreachable DaosUnreachable = -C.DER_UNREACH // DaosNoSpace indicates there was not enough storage space DaosNoSpace = -C.DER_NOSPACE // DaosAlready indicates the operation was already done DaosAlready = -C.DER_ALREADY // DaosNoMemory indicates the system ran out of memory DaosNoMemory = -C.DER_NOMEM // DaosNotImpl indicates the requested functionality is not implemented DaosNotImpl = -C.DER_NOSYS // DaosTimedOut indicates the operation timed out DaosTimedOut = -C.DER_TIMEDOUT // DaosBusy indicates the system was busy and didn't process the request DaosBusy = -C.DER_BUSY // DaosTryAgain indicates the operation failed, but should be tried again DaosTryAgain = -C.DER_AGAIN // DaosProtocolError indicates incompatibility in communications protocols DaosProtocolError = -C.DER_PROTO // DaosNotInit indicates something in the system wasn't initialized DaosNotInit = -C.DER_UNINIT // DaosBufTooSmall indicates a provided buffer was too small DaosBufTooSmall = -C.DER_TRUNC // DaosStructTooSmall indicates data could not fit in the provided structure DaosStructTooSmall = -C.DER_OVERFLOW // DaosCanceled indicates the operation was canceled DaosCanceled = -C.DER_CANCELED // DaosOutOfGroup indicates that a rank wasn't found in the group DaosOutOfGroup = -C.DER_OOG // DaosMercuryError indicates that there was an error in the Mercury transport layer DaosMercuryError = -C.DER_HG // DaosUnregistered indicates that a requested RPC was not registered DaosUnregistered = -C.DER_UNREG // DaosAddrStringFailed indicates that an address string couldn't be generated DaosAddrStringFailed = -C.DER_ADDRSTR_GEN // DaosPMIXError indicates an error in the PMIX layer DaosPMIXError = -C.DER_PMIX // DaosIVCallback indicates that the IV callback cannot be handled locally DaosIVCallback = -C.DER_IVCB_FORWARD // DaosMiscError indicates an unspecified error DaosMiscError = -C.DER_MISC // DaosBadPath indicates that a bad file or directory path was provided DaosBadPath = -C.DER_BADPATH // DaosNotDir indicates that the path is not to a directory DaosNotDir = -C.DER_NOTDIR // DaosCorpcIncomplete indicates that corpc failed DaosCorpcIncomplete = -C.DER_CORPC_INCOMPLETE // DaosNoRASRank indicates that no rank is subscribed to RAS DaosNoRASRank = -C.DER_NO_RAS_RANK // DaosNotAttached indicates that a service group is not attached DaosNotAttached = -C.DER_NOTATTACH // DaosMismatch indicates a version mismatch DaosMismatch = -C.DER_MISMATCH // DaosEvicted indicates that the rank was evicted DaosEvicted = -C.DER_EVICTED // DaosNoReply indicates that there was no reply to an RPC DaosNoReply = -C.DER_NOREPLY // DaosDenialOfService indicates that there was a denial of service DaosDenialOfService = -C.DER_DOS // DaosBadTarget indicates that the target was wrong for the RPC DaosBadTarget = -C.DER_BAD_TARGET // DaosGroupVersionMismatch indicates that group versions didn't match DaosGroupVersionMismatch = -C.DER_GRPVER )
const ( // DaosIOError indicates a generic IO error DaosIOError DaosStatus = -C.DER_IO // DaosFreeMemError indicates an error freeing memory DaosFreeMemError = -C.DER_FREE_MEM // DaosNoEntry indicates that the entry was not found DaosNoEntry = -C.DER_ENOENT // DaosUnknownType indicates that the entity type was unknown DaosUnknownType = -C.DER_NOTYPE // DaosUnknownSchema indicates that the entity schema was unknown DaosUnknownSchema = -C.DER_NOSCHEMA // DaosNotLocal indicates that the entity was not local DaosNotLocal = -C.DER_NOLOCAL // DaosStale indicates that a resource was stale DaosStale = -C.DER_STALE // DaosNotLeader indicates that the replica is not the service leader DaosNotLeader = -C.DER_NOTLEADER // DaosTargetCreateError indicates that target creation failed DaosTargetCreateError = -C.DER_TGT_CREATE // DaosEpochReadOnly indicates that the epoch couldn't be modified DaosEpochReadOnly = -C.DER_EP_RO // DaosEpochRecycled indicates that the epoch was recycled due to age DaosEpochRecycled = -C.DER_EP_OLD // DaosKeyTooBig indicates that the key is too big DaosKeyTooBig = -C.DER_KEY2BIG // DaosRecordTooBig indicates that the record is too big DaosRecordTooBig = -C.DER_REC2BIG // DaosIOInvalid indicates a mismatch between IO buffers and object extents DaosIOInvalid = -C.DER_IO_INVAL // DaosEventQueueBusy indicates that the event queue is busy DaosEventQueueBusy = -C.DER_EQ_BUSY // DaosDomainMismatch indicates that there was a mismatch of domains in cluster components DaosDomainMismatch = -C.DER_DOMAIN // DaosShutdown indicates that the service should shut down DaosShutdown = -C.DER_SHUTDOWN // DaosInProgress indicates that the operation is in progress DaosInProgress = -C.DER_INPROGRESS // DaosNotApplicable indicates that the operation is not applicable DaosNotApplicable = -C.DER_NOTAPPLICABLE // DaosNotReplica indicates that the requested component is not a service replica DaosNotReplica = -C.DER_NOTREPLICA // DaosChecksumError indicates a checksum error DaosChecksumError = -C.DER_CSUM )
const MaxMsgSize = 16384
MaxMsgSize is the maximum drpc message size that may be sent. Using a packetsocket over the unix domain socket means that we receive a whole message at a time without knowing its size. So for this reason we need to restrict the maximum message size so we can preallocate a buffer to put all of the information in. Corresponding C definition is found in include/daos/drpc.h
const ( // MethodRequestCredentials is a ModuleSecurityAgent method MethodRequestCredentials = C.DRPC_METHOD_SEC_AGENT_REQUEST_CREDS )
const ( // MethodValidateCredentials is a ModuleSecurity method MethodValidateCredentials = C.DRPC_METHOD_SEC_VALIDATE_CREDS )
Variables ¶
var Status_name = map[int32]string{
0: "SUCCESS",
1: "SUBMITTED",
2: "FAILURE",
3: "UNKNOWN_MODULE",
4: "UNKNOWN_METHOD",
5: "FAILED_UNMARSHAL_CALL",
6: "FAILED_UNMARSHAL_PAYLOAD",
7: "FAILED_MARSHAL",
}
var Status_value = map[string]int32{
"SUCCESS": 0,
"SUBMITTED": 1,
"FAILURE": 2,
"UNKNOWN_MODULE": 3,
"UNKNOWN_METHOD": 4,
"FAILED_UNMARSHAL_CALL": 5,
"FAILED_UNMARSHAL_PAYLOAD": 6,
"FAILED_MARSHAL": 7,
}
Functions ¶
Types ¶
type Call ¶
type Call struct { Module int32 `protobuf:"varint,1,opt,name=module,proto3" json:"module,omitempty"` Method int32 `protobuf:"varint,2,opt,name=method,proto3" json:"method,omitempty"` Sequence int64 `protobuf:"varint,3,opt,name=sequence,proto3" json:"sequence,omitempty"` Body []byte `protobuf:"bytes,4,opt,name=body,proto3" json:"body,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
* Call describes a function call to be executed over the dRPC channel.
func (*Call) Descriptor ¶
func (*Call) GetSequence ¶
func (*Call) ProtoMessage ¶
func (*Call) ProtoMessage()
func (*Call) XXX_DiscardUnknown ¶
func (m *Call) XXX_DiscardUnknown()
func (*Call) XXX_Unmarshal ¶
type ClientConnection ¶
ClientConnection represents a client connection to a dRPC server
func NewClientConnection ¶
func NewClientConnection(socket string) *ClientConnection
NewClientConnection creates a new dRPC client
func (*ClientConnection) Close ¶
func (c *ClientConnection) Close() error
Close shuts down the connection to the Unix Domain Socket
func (*ClientConnection) Connect ¶
func (c *ClientConnection) Connect() error
Connect opens a connection to the internal Unix Domain Socket path
func (*ClientConnection) IsConnected ¶
func (c *ClientConnection) IsConnected() bool
IsConnected indicates whether the client connection is currently active
type DaosStatus ¶ added in v0.9.0
type DaosStatus int32
DaosStatus is a status code in the set defined by the DAOS data plane.
type DomainSocketClient ¶
type DomainSocketClient interface { sync.Locker IsConnected() bool Connect() error Close() error SendMsg(call *Call) (*Response, error) }
DomainSocketClient is the interface to a dRPC client communicating over a Unix Domain Socket
type DomainSocketServer ¶
type DomainSocketServer struct {
// contains filtered or unexported fields
}
DomainSocketServer is the object that listens for incoming dRPC connections, maintains the connections for sessions, and manages the message processing.
func NewDomainSocketServer ¶
func NewDomainSocketServer(ctx context.Context, log logging.Logger, sock string) (*DomainSocketServer, error)
NewDomainSocketServer returns a new unstarted instance of a DomainSocketServer for the specified unix domain socket path.
func (*DomainSocketServer) Listen ¶
func (d *DomainSocketServer) Listen()
Listen listens for incoming connections on the UNIX domain socket and creates individual sessions for each one.
func (*DomainSocketServer) RegisterRPCModule ¶
func (d *DomainSocketServer) RegisterRPCModule(mod Module)
RegisterRPCModule takes a Module and associates it with the given DomainSocketServer so it can be used to process incoming dRPC calls.
func (*DomainSocketServer) Shutdown ¶
func (d *DomainSocketServer) Shutdown()
Shutdown places the state of the server to shutdown which terminates the Listen go routine and starts the cleanup of all open connections.
func (*DomainSocketServer) Start ¶
func (d *DomainSocketServer) Start() error
Start sets up the dRPC server socket and kicks off the listener goroutine.
type Failure ¶ added in v0.8.0
type Failure struct {
// contains filtered or unexported fields
}
Failure represents a dRPC protocol failure.
func MarshalingFailure ¶ added in v0.8.0
func MarshalingFailure() Failure
MarshalingFailure creates a Failure for a failed attempt at marshaling a response.
func NewFailure ¶ added in v0.8.0
NewFailure returns a Failure with the given status and a corresponding message.
func NewFailureWithMessage ¶ added in v0.8.0
NewFailureWithMessage returns a generic failure with a custom message
func UnknownMethodFailure ¶ added in v0.8.0
func UnknownMethodFailure() Failure
UnknownMethodFailure creates a Failure for unknown dRPC method.
func UnknownModuleFailure ¶ added in v0.8.0
func UnknownModuleFailure() Failure
UnknownModuleFailure creates a Failure for unknown dRPC module.
func UnmarshalingCallFailure ¶ added in v0.8.0
func UnmarshalingCallFailure() Failure
UnmarshalingCallFailure creates a Failure for a failed attempt to unmarshal an incoming call.
func UnmarshalingPayloadFailure ¶ added in v0.8.0
func UnmarshalingPayloadFailure() Failure
UnmarshalingPayloadFailure creates a Failure for a failed attempt to unmarshal a call payload.
type Module ¶
Module is an interface that a type must implement to provide the functionality needed by the ModuleService to process dRPC requests.
type ModuleService ¶
type ModuleService struct {
// contains filtered or unexported fields
}
ModuleService is the collection of Modules used by DomainSocketServer to be used to process messages.
func NewModuleService ¶
func NewModuleService(log logging.Logger) *ModuleService
NewModuleService creates an initialized ModuleService instance
func (*ModuleService) GetModule ¶
func (r *ModuleService) GetModule(id int32) (Module, bool)
GetModule fetches the module for the given ID. Returns true if found, false otherwise.
func (*ModuleService) ProcessMessage ¶
func (r *ModuleService) ProcessMessage(session *Session, msgBytes []byte) ([]byte, error)
ProcessMessage is the main entry point into the ModuleService. It accepts a marshaled drpc.Call instance, processes it, calls the handler in the appropriate Module, and marshals the result into the body of a drpc.Response.
func (*ModuleService) RegisterModule ¶
func (r *ModuleService) RegisterModule(mod Module) error
RegisterModule will take in a type that implements the Module interface and ensure that no other module is already registered with that module identifier.
type Response ¶
type Response struct { Sequence int64 `protobuf:"varint,1,opt,name=sequence,proto3" json:"sequence,omitempty"` Status Status `protobuf:"varint,2,opt,name=status,proto3,enum=drpc.Status" json:"status,omitempty"` Body []byte `protobuf:"bytes,3,opt,name=body,proto3" json:"body,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
* Response describes the result of a dRPC call.
func (*Response) Descriptor ¶
func (*Response) GetSequence ¶
func (*Response) ProtoMessage ¶
func (*Response) ProtoMessage()
func (*Response) XXX_DiscardUnknown ¶
func (m *Response) XXX_DiscardUnknown()
func (*Response) XXX_Marshal ¶
func (*Response) XXX_Unmarshal ¶
type Session ¶
Session represents an individual client connection to the Domain Socket Server.
func NewSession ¶
func NewSession(conn net.Conn, svc *ModuleService) *Session
NewSession creates a new dRPC Session object
func (*Session) ProcessIncomingMessage ¶
ProcessIncomingMessage listens for an incoming message on the session, calls its handler, and sends the response.
type Status ¶
type Status int32
* Status represents the valid values for a response status.
func ErrorToStatus ¶ added in v0.8.0
ErrorToStatus translates an error to a dRPC Status. In practice it checks to see if it was a dRPC Failure error, and uses the Status if so. Otherwise it is assumed to be a generic failure.