Documentation
¶
Overview ¶
Package rcserver binds the RC session server (rdma/librcserver.a) that implements the hipobj-rc-v2 two-phase transfer protocol.
The gateway owns routing, authentication, and the object backend; the C side owns the session state machine, QP/CQ/MR lifetimes, the data phase, and session reaping. Every cgo call is synchronous from the request goroutine.
Index ¶
- Constants
- Variables
- type DeviceOpts
- type Handle
- type PrepareRequest
- type PrepareResponse
- type PrincipalID
- type PutView
- type RCSvc
- func (s *RCSvc) BorrowStaging(sessionID string) (*StagingLease, error)
- func (s *RCSvc) Cancel(sessionID string, who PrincipalID) error
- func (s *RCSvc) Close()
- func (s *RCSvc) Context() context.Context
- func (s *RCSvc) FinishFinal(sessionID string) error
- func (s *RCSvc) FinishPrepare(sessionID string, committed bool) error
- func (s *RCSvc) FinishPut(view PutView, committed bool, etag, versionID string) error
- func (s *RCSvc) FinishStaging(lease StagingLease, ok bool, written int, etag, versionID string) error
- func (s *RCSvc) GetPutData(sessionID string) (*PutView, error)
- func (s *RCSvc) Leave()
- func (s *RCSvc) Prepare(req PrepareRequest) (*PrepareResponse, error)
- func (s *RCSvc) ReadyTransfer(req ReadyRequest) (*ReadyResponse, error)
- func (s *RCSvc) SessionInfo(sessionID string, who PrincipalID) (*SessionInfo, error)
- func (s *RCSvc) TryEnter() bool
- type ReadyRequest
- type ReadyResponse
- type SessionInfo
- type StagingLease
Constants ¶
const ( StatusOK = C.RC_OK StatusErrArg = C.RC_E_ARG StatusErrState = C.RC_E_STATE StatusErrSession = C.RC_E_SESSION StatusErrStale = C.RC_E_STALE StatusErrNoSession = C.RC_E_NO_SESSION StatusErrDouble = C.RC_E_DOUBLE StatusErrWire = C.RC_E_WIRE StatusErrShort = C.RC_E_SHORT StatusErrTrunc = C.RC_E_TRUNC StatusErrLimit = C.RC_E_LIMIT StatusErrInternal = C.RC_E_INTERNAL )
Status codes mirrored from rc_server_abi.h.
const ( ReadyOK = C.RC_READY_OK ReadyBusy = C.RC_READY_BUSY ReadyTimeout = C.RC_READY_TIMEOUT ReadyVerifyFail = C.RC_READY_VERIFY_FAIL ReadyWireFail = C.RC_READY_WIRE_FAIL )
Ready outcome detail codes (rc_ready_resp.outcome).
Variables ¶
var ( ErrArg = errors.New("rcserver: invalid argument") ErrState = errors.New("rcserver: wrong session state") ErrSession = errors.New("rcserver: owner mismatch") ErrStale = errors.New("rcserver: stale handle or session") ErrNoSession = errors.New("rcserver: no such session") ErrDouble = errors.New("rcserver: duplicate borrow") ErrWire = errors.New("rcserver: verbs transfer failure") ErrShort = errors.New("rcserver: short transfer") ErrTrunc = errors.New("rcserver: value too long") ErrLimit = errors.New("rcserver: resource limit") ErrInternal = errors.New("rcserver: internal error") )
Sentinel errors matched by errors.Is for each ABI status.
Functions ¶
This section is empty.
Types ¶
type DeviceOpts ¶
type DeviceOpts struct {
// GidHint selects the device whose GID starts with this dotted
// prefix; empty picks the first verbs device.
GidHint string
Port uint8
GidIdx int
// Global limits.
MaxSessions uint32
MaxStagingBytes uint64
MaxQPs uint32
MaxUserSessions uint32
MaxUserStagingBytes uint64
MaxUserQPs uint32
// Timeouts in milliseconds.
TPrepMs uint64
TExecMs uint64
// Concurrency slots (0 picks the C-side default 64/32).
MaxReadySlots uint32
MaxStageSlots uint32
}
DeviceOpts configures device selection and resource limits.
type PrepareRequest ¶
type PrepareRequest struct {
Principal PrincipalID
Op uint8 // 0 = GET, 1 = PUT
Target string
Offset uint64
Size uint64
ClientPsn uint32
Cookie uint32
ClientToken string // 88-hex, optional
}
PrepareRequest carries the PREPARE wire parameters.
type PrepareResponse ¶
type PrepareResponse struct {
SessionID string
ServerQpn uint32
ServerPsn uint32
StagingAddr uint64
StagingRkey uint32
ReplyToken string
}
PrepareResponse is the PREPARE reply.
type PrincipalID ¶
type PrincipalID [32]byte
PrincipalID is the SHA-256 digest identifying the requester.
type PutView ¶
PutView is a borrowed PUT data view. The caller must return it with FinishPut exactly once.
type RCSvc ¶
type RCSvc struct {
// contains filtered or unexported fields
}
RCSvc owns the RC session server. Handlers must call TryEnter before any session call and Leave when the request completes (defer). Close stops admissions, cancels the service context (bound to every handler's backend I/O so in-flight requests unblock), waits for every entered call to leave, then tears the server down; it is idempotent and safe from any goroutine.
func Init ¶
func Init(opts DeviceOpts) (*RCSvc, error)
Init opens the verbs device and returns a service.
func (*RCSvc) BorrowStaging ¶
func (s *RCSvc) BorrowStaging(sessionID string) (*StagingLease, error)
BorrowStaging borrows the GET staging buffer.
func (*RCSvc) Cancel ¶
func (s *RCSvc) Cancel(sessionID string, who PrincipalID) error
Cancel cancels a session (owner-checked).
func (*RCSvc) Close ¶
func (s *RCSvc) Close()
Close shuts the service down: it stops admissions, marks every session for reaping, waits for all in-flight handlers to finish, and destroys the server. Safe to call multiple times.
Convergence: every blocking call an RC handler makes after TryEnter is bounded - GET staging, PUT commit, and the bucket-ACL lookup run under the service context and unblock on the cancel below; and the authorization helpers (VerifyAccess, CheckObjectAccess) consume the fiber request context, which the gateway shuts down before RunVersityGW returns - and Close runs after RunVersityGW returns in every current caller - so those calls are cancelled by the fiber shutdown that precedes Close.
func (*RCSvc) Context ¶
Context returns the service-lifetime context. Handlers bind their backend calls to it so Close unblocks in-flight I/O.
func (*RCSvc) FinishFinal ¶
FinishFinal marks the FINAL response committed.
func (*RCSvc) FinishPrepare ¶
FinishPrepare commits or aborts a PREPARE.
func (*RCSvc) FinishStaging ¶
func (s *RCSvc) FinishStaging(lease StagingLease, ok bool, written int, etag, versionID string) error
FinishStaging returns a staging lease (GET).
func (*RCSvc) GetPutData ¶
GetPutData borrows the PUT data view.
func (*RCSvc) Prepare ¶
func (s *RCSvc) Prepare(req PrepareRequest) (*PrepareResponse, error)
Prepare creates a session (PREPARE).
func (*RCSvc) ReadyTransfer ¶
func (s *RCSvc) ReadyTransfer(req ReadyRequest) (*ReadyResponse, error)
ReadyTransfer runs the data phase (READY).
func (*RCSvc) SessionInfo ¶
func (s *RCSvc) SessionInfo(sessionID string, who PrincipalID) (*SessionInfo, error)
SessionInfo looks up a session's op and target (READY auth).
type ReadyRequest ¶
type ReadyRequest struct {
Principal PrincipalID
SessionID string
Cookie uint32
ClientQpn uint32
ClientMrAddr uint64
ClientMrRkey uint32
}
ReadyRequest carries the READY wire parameters.
type ReadyResponse ¶
type ReadyResponse struct {
BytesTransferred uint64
CookieEcho uint32
// Outcome mirrors the RC_READY_* enum: returned atomically
// with the transfer result so a concurrent READY cannot
// rewrite it between the transfer and the read.
Outcome int
Etag string
VersionID string
}
ReadyResponse is the READY reply.
type SessionInfo ¶
SessionInfo describes a session for READY re-authorization.
type StagingLease ¶
StagingLease is a borrowed GET staging buffer. The caller must return it with FinishStaging exactly once.