jrpcfs

package
v0.0.0-...-653efa9 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2021 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Overview

Package jrpcfs implements a JSON RPC interface to package fs.

The structs in this file are used as parameters to the Server methods found in filesystem.go and middleware.go.

NOTE: Please try to keep the definitions in this file in alphabetical order.

Using the JSON RPC APIs from outside of proxyfsd:

  • The types defined here and in filesystem.go are not available outside of proxyfs, so one must use the JSON RPC, which is defined here: https://en.wikipedia.org/wiki/JSON-RPC

  • JSON RPC expects a request with the following format: "method": <string that identifies the RPC method> "params": [<args for the particular method>] "jsonrpc": "2.0" "id": <my RPC request id; client-defined>

    NOTE: the "id" here is just used to match request/response.

  • A JSON RPC response will look like this: "id": <id of request> "error": <error string or nil if no error> "result": <encoded result data>

EXAMPLE:

As an example, let's look at doing a mount.

The Go-side definitions of interest are:

From this file:

type MountRequestByVolumeName struct {
    VolumeName   string
    MountOptions uint64
}

type MountReply struct {
    MountID            MountIDAsString
    RootDirInodeNumber uint64
}

From filesystem.go:

 func (s *Server) RpcMount(in *MountRequest, reply *MountReply) error

It may be easiest to represent what needs to be sent to the proxyfs RPC
server in Python:

  # The args for RpcMount are defined in MountRequest. The arg names used
  # must be exactly the same as the names in the Go-side struct.
  #
  # For the expected type for each argument, see the definition of the
  # appropriate request/response struct in this file.
  #
  args = {'VolumeName' : "CommonVolume", 'MountOptions': 0}

  # Start our client-side request numbering at 0
  #
  id = 0

  # This will become the JSON request once we encode it
  #
  payload = {
      "method": "Server.RpcMountByVolumeName", # This will always be "Server."<method name from filesystem.go>
      "params": [args],                        # Args must be encoded in an array here!
      "jsonrpc": "2.0",                        # JSON RPC version
      "id": id,                                # Client request id
  }

  # Encode payload into JSON
  #
  data = json.dumps((payload))

  # Send request over socket. Ignore socket specifics here.
  #
  s = socket.create_connection(("localhost", 12345))
  s.sendall(data)

Now we receive and decode the response from the proxyfsd RPC server.

  # Read response from socket. Ignore socket specifics here.
  #
  # (Note that the size of 1024 here will not work for all calls; this
  # is just a simple example).
  #
  rdata = s.recv(1024)

  # Decode response out of JSON
  #
  resp = json.loads(rdata)

  # Check that id from response is the same as our request
  #
  if resp["id"] != id:
      raise Exception("expected id=%s, received id=%s: %s" %(id, resp["id"], resp["error"]))

  # Check whether there was an error in handling the request
  #
  if resp["error"] is not None:
      raise Exception(resp["error"])

  # If we got this far, we can check out the response. The response
  # contents will consist of the content of the response struct for
  # this particular request. In this case, that is the contents of
  # the MountReply structure.
  #
  # Note that it's generally good practice to check for the presence
  # of the key before using the value...
  #
  print "Returned MountID:  ", resp["result"]["MountID"]
  print "Returned rootInode:", resp["result"]["RootDirInodeNumber"]

On the C-side, jrpcclient leverages the popular json-c library. One glaring ommission of json-c is
support for unsigned integers... specifically uint64_t's. The parser actually substitutes for any
"number" that is bigger than math.MaxInt64 with math.MaxInt64 - rather than converting to the
bit-compatible uint64_t interpretation. It's a mystery why... but this choice has spurred several
to request json-c expand to directly support (particularly) uint64_t. Efforts have been started but,
alas, never completed.

The ProxyFS work-around will be to pass vulnerable uint64's that have practical cases where the
upper-most bit (the "sign" bit if it was an int64) as int64's. The int64 value will be the equivalent
such that casting between int64_t's and uint64_t's will result in the desired value. It just so
happens that jrpcclient is already doing the casting back and forth, so making that possible on the
(here) Go side resolves the issue.

The impact on this change for the other JSON RPC client, pfs_middleware, should not be noticable so
long as the cases where a uint64 comes across as a negative int64 are opaque to pfs_middleware.

It turns out that all uint64's previously in the jrpcfs-specified RPC (i.e. those in api.go) fall
into three categories:

  Practically never > math.MaxInt64 - e.g. Stat.Size
  Possibly          > math.MaxInt64 - specifically SnapShotIDs adorning InodeNumbers

In the "Possibly" category, the InodeNumbers are the worry here. Fortunately, InodeNumbers are
considered "opaque" handles to ProxyFS resources and, as such, only need to preserve this identity
property (whether signed or unsigned). For this reason, all InodeNumbers in the following API are
passed as int64's rather than uint64's. In the case where the InodeNumber > math.MaxInt64, care
is taken such that the negative value passed via the int64 is cast to the proper (large) uint64
on each side of the RPC consistently.

JSON RPC Server on top of FS package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AllocOpProfiles

func AllocOpProfiles() (theOpProfiles map[OpType]opProfiles)

func DumpAndFreeStats

func DumpAndFreeStats(s *Server)

How to clean up? Move profiler to some stale list? Just delete?

func DumpIfNecessary

func DumpIfNecessary(s *Server)

func DumpProfileMap

func DumpProfileMap(profilerMap *opProfiles)

func NewOpProfiles

func NewOpProfiles() opProfiles

func SaveProfiler

func SaveProfiler(s *Server, op OpType, profiler *utils.Profiler)

This is purposely not a method in Server, since if is is one then net/rpc/server.go complains that it has the wrong number of ins/outs, from a check in suitableMethods().

func UnixNanosec

func UnixNanosec(t time.Time) (ns int64)

func UnixSec

func UnixSec(t time.Time) (sec int64)

Types

type AccessRequest

type AccessRequest struct {
	InodeHandle
	UserID     int32
	GroupID    int32
	AccessMode uint32
}

AccessRequest is the request object for RpcAccess.

type ChmodPathRequest

type ChmodPathRequest struct {
	PathHandle
	FileMode uint32
}

ChmodPathRequest is the request object for RpcChmodPath.

type ChmodRequest

type ChmodRequest struct {
	InodeHandle
	FileMode uint32
}

ChmodRequest is the request object for RpcChmod.

type ChownPathRequest

type ChownPathRequest struct {
	PathHandle
	UserID  int32
	GroupID int32
}

ChownPathRequest is the request object for RpcChownPath.

type ChownRequest

type ChownRequest struct {
	InodeHandle
	UserID  int32
	GroupID int32
}

ChownRequest is the request object for RpcChown.

type CoalesceReply

type CoalesceReply struct {
	ModificationTime uint64
	AttrChangeTime   uint64
	InodeNumber      int64
	NumWrites        uint64
}

type CoalesceReq

type CoalesceReq struct {
	VirtPath                    string
	ElementAccountRelativePaths []string
	// New or updated HTTP metadata to be stored
	NewMetaData []byte
}

type CreateContainerReply

type CreateContainerReply struct {
}

CreateContainerReply is the reply object for RpcCreateContainer.

type CreateContainerRequest

type CreateContainerRequest struct {
	VirtPath string
}

CreateContainerRequest is the request object for RpcCreateContainer.

type CreatePathRequest

type CreatePathRequest struct {
	PathHandle
	UserID   int32
	GroupID  int32
	FileMode uint32
}

CreatePathRequest is the request object for RpcCreatePath.

type CreateRequest

type CreateRequest struct {
	InodeHandle
	Basename string
	UserID   int32
	GroupID  int32
	FileMode uint32
}

CreateRequest is the request object for RpcCreate.

type DeleteReply

type DeleteReply struct {
}

DeleteReply is the response object for RpcDelete

type DeleteReq

type DeleteReq struct {
	VirtPath string
}

DeleteReq is the request object for RpcDelete

type DirEntry

type DirEntry struct {
	InodeNumber     int64
	FileType        uint16
	Basename        string
	NextDirLocation int64
}

DirEntry is used as part of ReaddirReply and ReaddirPlusReply.

FileType here will be a uint16 containing DT_DIR|DT_REG|DT_LNK.

type FetchExtentMapChunkReply

type FetchExtentMapChunkReply struct {
	FileOffsetRangeStart uint64                       // Holes in [FileOffsetRangeStart:FileOffsetRangeEnd)
	FileOffsetRangeEnd   uint64                       //   not covered in ExtentMapEntry slice should "read-as-zero"
	FileSize             uint64                       //   up to the end-of-file as indicated by FileSize
	ExtentMapEntry       []inode.ExtentMapEntryStruct // All will be in [FileOffsetRangeStart:FileOffsetRangeEnd)
}

FetchExtentMapChunkReply is the response object for RpcFetchExtentMapChunk.

type FetchExtentMapChunkRequest

type FetchExtentMapChunkRequest struct {
	InodeHandle
	FileOffset                 uint64
	MaxEntriesFromFileOffset   int64
	MaxEntriesBeforeFileOffset int64
}

FetchExtentMapChunkRequest is the request object for RpcFetchExtentMapChunk.

type FlockReply

type FlockReply struct {
	FlockType   int32
	FlockWhence int32
	FlockStart  uint64
	FlockLen    uint64
	FlockPid    uint64
}

type FlockRequest

type FlockRequest struct {
	InodeHandle
	FlockCmd    int32
	FlockType   int32
	FlockWhence int32
	FlockStart  uint64
	FlockLen    uint64
	FlockPid    uint64
}

type FlushRequest

type FlushRequest struct {
	InodeHandle
	SendTimeSec  int64
	SendTimeNsec int64
}

FlushRequest is the request object for RpcFlush.

type GetAccountReply

type GetAccountReply struct {
	AccountEntries   []fs.AccountEntry
	ModificationTime uint64
	AttrChangeTime   uint64
}

Response object for RpcGetAccount

type GetAccountReq

type GetAccountReq struct {
	VirtPath   string // account path, e.g. /v1/AUTH_acc
	Marker     string // marker from query string, used in pagination
	EndMarker  string // endmarker from query string, used in pagination
	MaxEntries uint64 // maximum number of entries to return
}

Request object for RpcGetAccount

type GetContainerReply

type GetContainerReply struct {
	ContainerEntries []fs.ContainerEntry
	ModificationTime uint64
	AttrChangeTime   uint64
	Metadata         []byte // container metadata, serialized
}

GetContainerReply is the response object for RpcGetContainer

type GetContainerReq

type GetContainerReq struct {
	VirtPath   string // virtual container path, e.g. /v1/AUTH_acc/some-dir
	Marker     string // marker from query string, used in pagination
	EndMarker  string // endmarker from query string, used in pagination
	Prefix     string // only look at entries starting with this
	MaxEntries uint64 // maximum number of entries to return
	Delimiter  string // only match up to the first occurrence of delimiter (excluding prefix)
}

GetContainerReq is the request object for RpcGetContainer

type GetObjectReply

type GetObjectReply struct {
	FileSize         uint64               // size of the file, in bytes
	IsDir            bool                 // true if directory
	ReadEntsOut      []inode.ReadPlanStep // object/length/offset triples where the data is found
	InodeNumber      uint64
	NumWrites        uint64
	Metadata         []byte // serialized object metadata (previously set by middleware empty if absent)
	ModificationTime uint64 // file's mtime in nanoseconds since the epoch
	AttrChangeTime   uint64
	LeaseId          string
}

GetObjectReply is the response object for RpcGetObject

type GetObjectReq

type GetObjectReq struct {
	// Virtual path to be read. Refers to an object, e.g.
	// /v1/AUTH_acc/a-container/an-object
	VirtPath string

	// Ranges to be read from virtual path. Note: these are
	// offset/length pairs, not HTTP byte ranges; please remember
	// to convert the values. To obtain a read plan for the entire
	// object, leave ReadEntsIn empty.
	ReadEntsIn []fs.ReadRangeIn
}

GetObjectReq is the request object for RpcGetObject

type GetStatPathRequest

type GetStatPathRequest struct {
	PathHandle
}

GetStatPathRequest is the request object for RpcGetStatPath.

type GetStatRequest

type GetStatRequest struct {
	InodeHandle
}

GetStatRequest is the request object for RpcGetStat.

type GetXAttrPathRequest

type GetXAttrPathRequest struct {
	PathHandle
	AttrName string
}

type GetXAttrReply

type GetXAttrReply struct {
	AttrValueSize uint64
	AttrValue     []byte
}

type GetXAttrRequest

type GetXAttrRequest struct {
	InodeHandle
	AttrName string
}

type HeadReply

type HeadReply struct {
	FileSize         uint64
	IsDir            bool
	ModificationTime uint64 // nanoseconds since epoch
	AttrChangeTime   uint64 // nanoseconds since epoch
	InodeNumber      int64
	NumWrites        uint64
	Metadata         []byte // entity metadata, serialized
}

type HeadReq

type HeadReq struct {
	VirtPath string // virtual entity path, e.g. /v1/AUTH_acc/some-dir[/some-file]
}

type InodeHandle

type InodeHandle struct {
	MountID     MountIDAsString
	InodeNumber int64
}

InodeHandle is embedded in a number of the request objects.

type InodeReply

type InodeReply struct {
	InodeNumber int64
}

InodeReply is the reply object for requests that return an inode number. This response object is used by a number of the methods.

type IsAccountBimodalReply

type IsAccountBimodalReply struct {
	IsBimodal               bool
	ActivePeerPrivateIPAddr string
}

IsAccountBimodalReply is the response object for RpcPutLocation

type IsAccountBimodalReq

type IsAccountBimodalReq struct {
	AccountName string
}

IsAccountBimodalReq is the request object for RpcIsAccountBimodal

type LeaseReply

type LeaseReply struct {
	LeaseReplyType // One of LeaseReplyType*
}

LeaseReply is the reply object for RpcLease

type LeaseReplyType

type LeaseReplyType uint32

LeaseReplyType specifies the acknowledgement that the requested lease operation has been completed or denied (e.g. when a Promotion request cannot be satisfied and the client will soon be receiving a LeaseInterruptTypeRelease)

const (
	LeaseReplyTypeDenied    LeaseReplyType = iota // Request denied (e.g. Promotion deadlock avoidance)
	LeaseReplyTypeShared                          // SharedLease granted
	LeaseReplyTypePromoted                        // SharedLease promoted to ExclusiveLease
	LeaseReplyTypeExclusive                       // ExclusiveLease granted
	LeaseReplyTypeDemoted                         // ExclusiveLease demoted to SharedLease
	LeaseReplyTypeReleased                        // SharedLease or ExclusiveLease released
)

type LeaseRequest

type LeaseRequest struct {
	InodeHandle
	LeaseRequestType // One of LeaseRequestType*
}

LeaseRequest is the request object for RpcLease

type LeaseRequestType

type LeaseRequestType uint32

LeaseRequestType specifies the requested lease operation

const (
	LeaseRequestTypeShared    LeaseRequestType = iota // Currently unleased, requesting SharedLease
	LeaseRequestTypePromote                           // Currently SharedLease held, requesting promoting to ExclusiveLease
	LeaseRequestTypeExclusive                         // Currently unleased, requesting ExclusiveLease
	LeaseRequestTypeDemote                            // Currently ExclusiveLease held, requesting demotion to SharedLease
	LeaseRequestTypeRelease                           // Currently SharedLease or ExclusiveLease held, releasing it
)

type LinkPathRequest

type LinkPathRequest struct {
	PathHandle
	TargetFullpath string
}

LinkPathRequest is the request object for RpcLinkPath.

type LinkRequest

type LinkRequest struct {
	InodeHandle
	Basename          string
	TargetInodeNumber int64
}

LinkRequest is the request object for RpcLink.

type ListXAttrPathRequest

type ListXAttrPathRequest struct {
	PathHandle
}

type ListXAttrReply

type ListXAttrReply struct {
	AttrNames []string
}

type ListXAttrRequest

type ListXAttrRequest struct {
	InodeHandle
}

type LogRequest

type LogRequest struct {
	Message string
}

LogRequest is the request object for RpcLog.

type LookupPathRequest

type LookupPathRequest struct {
	MountID  MountIDAsString
	Fullpath string
}

LookupPathRequest is the request object for RpcLookupPath.

type LookupPlusReply

type LookupPlusReply struct {
	InodeNumber int64
	StatStruct
}

LookupPlusReply is the reply object for RpcLookupPlus.

type LookupPlusRequest

type LookupPlusRequest struct {
	InodeHandle
	Basename string
}

LookupPlusRequest is the request object for RpcLookupPlus.

type LookupRequest

type LookupRequest struct {
	InodeHandle
	Basename string
}

LookupRequest is the request object for RpcLookup.

type MiddlewareMkdirReply

type MiddlewareMkdirReply struct {
	ModificationTime uint64
	AttrChangeTime   uint64
	InodeNumber      int64
	NumWrites        uint64
}

type MiddlewareMkdirReq

type MiddlewareMkdirReq struct {

	// Virtual path of the directory to be created
	VirtPath string

	// HTTP metadata to be stored
	Metadata []byte
}

type MiddlewarePostReply

type MiddlewarePostReply struct {
}

MiddlewarePostReply is the reply object for RpcPost

type MiddlewarePostReq

type MiddlewarePostReq struct {

	// Virtual path to be read.  This could be account, account/container or account/container/object
	VirtPath string

	// New or updated HTTP metadata to be stored
	NewMetaData []byte

	// Last MetaData known by caller - used to resolve races between clients by doing read/modify/write
	OldMetaData []byte
}

MiddlewarePostReq is the request object for RpcPost

type MkdirPathRequest

type MkdirPathRequest struct {
	PathHandle
	UserID   int32
	GroupID  int32
	FileMode uint32
}

MkdirPathRequest is the request object for RpcMkdirPath.

type MkdirRequest

type MkdirRequest struct {
	InodeHandle
	Basename string
	UserID   int32
	GroupID  int32
	FileMode uint32
}

MkdirRequest is the request object for RpcMkdir.

type MountByAccountNameReply

type MountByAccountNameReply struct {
	MountID                  MountIDAsString
	RootDirInodeNumber       int64
	RetryRPCPublicIPAddr     string
	RetryRPCPort             uint16
	RootCAx509CertificatePEM []byte
}

MountByAccountNameReply is the reply object for RpcMountByAccountName.

type MountByAccountNameRequest

type MountByAccountNameRequest struct {
	AccountName  string
	MountOptions uint64
	AuthUserID   uint64
	AuthGroupID  uint64
}

MountByAccountNameRequest is the request object for RpcMountByAccountName.

type MountByVolumeNameReply

type MountByVolumeNameReply struct {
	MountID                  MountIDAsString
	RootDirInodeNumber       int64
	RetryRPCPublicIPAddr     string
	RetryRPCPort             uint16
	RootCAx509CertificatePEM []byte
}

MountByVolumeNameReply is the reply object for RpcMountByVolumeName.

type MountByVolumeNameRequest

type MountByVolumeNameRequest struct {
	VolumeName   string
	MountOptions uint64
	AuthUserID   uint64
	AuthGroupID  uint64
}

MountByVolumeNameRequest is the request object for RpcMountByVolumeName.

type MountIDAsByteArray

type MountIDAsByteArray [16]byte

MountID is embedded in a number of request objects (as well as InodeHandle & PathHandle)

For Reads/Writes, the binary form of MountID will be used For Non-Reads/Writes, a base64.StdEncoding.Encode() of the binary form of MountID will be used

type MountIDAsString

type MountIDAsString string

type OpType

type OpType int

Enumeration of operations, used for stats-related things

const (
	PingOp OpType = iota
	ReadOp
	WriteOp
	ProvisionObjectOp
	WroteOp
	FetchExtentMapChunkOp
	FlushOp
	LookupOp
	LookupPathOp
	GetStatOp
	GetStatPathOp
	GetXattrOp
	GetXattrPathOp
	ReaddirOp
	ReaddirByLocOp
	ReaddirPlusOp
	ReaddirPlusByLocOp
	InvalidOp // Keep this as the last entry!
)

NOTE: When you add a new OpType here, be sure to add its string

at the appropriate spot in opTypeStrs below.

func (OpType) String

func (op OpType) String() string

Return operation type as a string

type PathHandle

type PathHandle struct {
	MountID  MountIDAsString
	Fullpath string
}

PathHandle is embedded in a number of the request objects.

type PingReply

type PingReply struct {
	Message string
}

PingReply is the response object for RpcPutLocation

type PingReq

type PingReq struct {
	Message string
}

PingReq is the request object for RpcPing

type ProvisionObjectReply

type ProvisionObjectReply struct {
	PhysPath string
}

type ProvisionObjectRequest

type ProvisionObjectRequest struct {
	MountID MountIDAsString
}

type PutCompleteReply

type PutCompleteReply struct {
	ModificationTime uint64
	AttrChangeTime   uint64
	InodeNumber      int64
	NumWrites        uint64
}

PutCompleteReply is the response object for RpcPutComplete

type PutCompleteReq

type PutCompleteReq struct {
	VirtPath    string
	PhysPaths   []string
	PhysLengths []uint64
	Metadata    []byte
}

PutCompleteReq is the request object for RpcPutComplete

type PutContainerReply

type PutContainerReply struct {
}

type PutContainerReq

type PutContainerReq struct {
	VirtPath    string
	NewMetadata []byte
	OldMetadata []byte
}

Types for RpcPutContainer

type PutLocationReply

type PutLocationReply struct {
	PhysPath string
}

PutLocationReply is the response object for RpcPutLocation

type PutLocationReq

type PutLocationReq struct {
	VirtPath string
}

PutLocationReq is the request object for RpcPutLocation

type RPCInterrupt

type RPCInterrupt struct {
	RPCInterruptType       // One of RPCInterruptType*
	InodeNumber      int64 // if RPCInterruptType == RPCInterruptTypeUnmount, InodeNumber == 0 (ignored)
}

RPCInterrupt is the "upcall" mechanism used by ProxyFS to interrupt the client

type RPCInterruptType

type RPCInterruptType uint32

RPCInterruptType specifies the action (unmount, demotion, or release) requested by ProxyFS of the client in an RpcInterrupt "upcall" to indicate that a lease or leases must be demoted or released

const (
	// RPCInterruptTypeUnmount indicates all Leases should be released (after performing necessary
	// state saving RPCs) and the client should unmount
	//
	RPCInterruptTypeUnmount RPCInterruptType = iota

	// RPCInterruptTypeDemote indicates the specified LeaseHandle should (at least) be demoted
	// from Exclusive to Shared (after performing necessary state saving RPCs)
	//
	RPCInterruptTypeDemote

	// RPCInterruptTypeRelease indicates the specified LeaseHandle should be released (after
	// performing state saving RPCs and invalidating such cached state)
	//
	RPCInterruptTypeRelease
)

type ReadSymlinkPathRequest

type ReadSymlinkPathRequest struct {
	PathHandle
}

ReadSymlinkPathRequest is the request object for RpcReadSymlinkPath.

type ReadSymlinkReply

type ReadSymlinkReply struct {
	Target string
}

ReadSymlinkReply is the reply object for RpcReadSymlink and RpcReadSymlinkPath.

type ReadSymlinkRequest

type ReadSymlinkRequest struct {
	InodeHandle
}

ReadSymlinkRequest is the request object for RpcReadSymlink.

type ReaddirByLocRequest

type ReaddirByLocRequest struct {
	InodeHandle
	MaxEntries         uint64
	PrevDirEntLocation int64
}

ReaddirByLocRequest is the request object for RpcReaddirByLoc.

type ReaddirPlusByLocRequest

type ReaddirPlusByLocRequest struct {
	InodeHandle
	MaxEntries         uint64
	PrevDirEntLocation int64
}

ReaddirPlusByLocRequest is the request object for RpcReaddirPlusByLoc.

type ReaddirPlusReply

type ReaddirPlusReply struct {
	DirEnts  []DirEntry
	StatEnts []StatStruct
}

ReaddirPlusReply is the reply object for RpcReaddirPlus and RpcReaddirPlusByLoc.

type ReaddirPlusRequest

type ReaddirPlusRequest struct {
	InodeHandle
	MaxEntries     uint64
	PrevDirEntName string
}

ReaddirPlusRequest is the request object for RpcReaddirPlus.

type ReaddirReply

type ReaddirReply struct {
	DirEnts []DirEntry
}

ReaddirReply is the reply object for RpcReaddir and RpcReaddirByLoc.

type ReaddirRequest

type ReaddirRequest struct {
	InodeHandle
	MaxEntries     uint64
	PrevDirEntName string
}

ReaddirRequest is the request object for RpcReaddir.

type ReleaseLeaseReply

type ReleaseLeaseReply struct{}

type ReleaseLeaseReq

type ReleaseLeaseReq struct {
	LeaseId string
}

type RemoveXAttrPathRequest

type RemoveXAttrPathRequest struct {
	PathHandle
	AttrName string
}

type RemoveXAttrRequest

type RemoveXAttrRequest struct {
	InodeHandle
	AttrName string
}

type RenamePathRequest

type RenamePathRequest struct {
	PathHandle
	DstFullpath string
}

RenamePathRequest is the request object for RpcRenamePath.

type RenameRequest

type RenameRequest struct {
	MountID           MountIDAsString
	SrcDirInodeNumber int64
	SrcBasename       string
	DstDirInodeNumber int64
	DstBasename       string
}

RenameRequest is the request object for RpcRename.

type RenewLeaseReply

type RenewLeaseReply struct{}

type RenewLeaseReq

type RenewLeaseReq struct {
	LeaseId string
}

type Reply

type Reply struct {
	RequestTimeSec  int64
	RequestTimeNsec int64
	SendTimeSec     int64
	SendTimeNsec    int64
}

Reply is a generic response object used when no values need to be returned. This response object is used by a number of the methods.

type ResizeRequest

type ResizeRequest struct {
	InodeHandle
	NewSize uint64
}

ResizeRequest is the request object for RpcResize.

type Server

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

All of our RPC methods are called on/passed this Server struct.

func NewServer

func NewServer() *Server

func (*Server) RpcAccess

func (s *Server) RpcAccess(in *AccessRequest, reply *InodeReply) (err error)

func (*Server) RpcChmod

func (s *Server) RpcChmod(in *ChmodRequest, reply *Reply) (err error)

func (*Server) RpcChmodPath

func (s *Server) RpcChmodPath(in *ChmodPathRequest, reply *Reply) (err error)

func (*Server) RpcChown

func (s *Server) RpcChown(in *ChownRequest, reply *Reply) (err error)

func (*Server) RpcChownPath

func (s *Server) RpcChownPath(in *ChownPathRequest, reply *Reply) (err error)

func (*Server) RpcCoalesce

func (s *Server) RpcCoalesce(in *CoalesceReq, reply *CoalesceReply) (err error)

Combine a bunch of files together into a big one. It's like "cat old1 old2 ... > new", but without the cat. Also removes the files old1 old2 ...

func (*Server) RpcCreate

func (s *Server) RpcCreate(in *CreateRequest, reply *InodeReply) (err error)

func (*Server) RpcCreateContainer

func (s *Server) RpcCreateContainer(in *CreateContainerRequest, reply *CreateContainerReply) (err error)

RpcCreateContainer is used by Middleware to PUT of a container.

TODO - add update of metadata TODO - combine this into one PUT RPC instead of multiple RPCs?

func (*Server) RpcCreatePath

func (s *Server) RpcCreatePath(in *CreatePathRequest, reply *InodeReply) (err error)

func (*Server) RpcDelete

func (s *Server) RpcDelete(in *DeleteReq, reply *DeleteReply) (err error)

RpcDelete is used by Middleware to service a DELETE HTTP request.

This routine has to handle delete of an empty container as well as delete of an objectName where objectName could be "file1", "dir1/file1", "dir1/dir2", etc.

func (*Server) RpcFetchExtentMapChunk

func (s *Server) RpcFetchExtentMapChunk(in *FetchExtentMapChunkRequest, reply *FetchExtentMapChunkReply) (err error)

func (*Server) RpcFlock

func (s *Server) RpcFlock(in *FlockRequest, reply *FlockReply) (err error)

func (*Server) RpcFlush

func (s *Server) RpcFlush(in *FlushRequest, reply *Reply) (err error)

func (*Server) RpcGetAccount

func (s *Server) RpcGetAccount(in *GetAccountReq, reply *GetAccountReply) (err error)

RpcGetAccount is used by Middleware to issue a GET on an account and return the results.

func (*Server) RpcGetContainer

func (s *Server) RpcGetContainer(in *GetContainerReq, reply *GetContainerReply) (err error)

RpcGetContainer is used by Middleware to issue a GET on a container and return the results.

func (*Server) RpcGetObject

func (s *Server) RpcGetObject(in *GetObjectReq, reply *GetObjectReply) (err error)

RpcGetObject is used by GET HTTP request to retrieve the read plan for an object.

func (*Server) RpcGetStat

func (s *Server) RpcGetStat(in *GetStatRequest, reply *StatStruct) (err error)

func (*Server) RpcGetStatPath

func (s *Server) RpcGetStatPath(in *GetStatPathRequest, reply *StatStruct) (err error)

func (*Server) RpcGetXAttr

func (s *Server) RpcGetXAttr(in *GetXAttrRequest, reply *GetXAttrReply) (err error)

func (*Server) RpcGetXAttrPath

func (s *Server) RpcGetXAttrPath(in *GetXAttrPathRequest, reply *GetXAttrReply) (err error)

func (*Server) RpcHead

func (s *Server) RpcHead(in *HeadReq, reply *HeadReply) (err error)

RpcHead is used by Middleware to issue a HEAD on a container or object and return the results.

func (*Server) RpcIsAccountBimodal

func (s *Server) RpcIsAccountBimodal(in *IsAccountBimodalReq, reply *IsAccountBimodalReply) (err error)

RpcIsAccountBimodal answers the question "is this account known by ProxyFS to be bimodal?".

If bimodal, also indicates the PrivateIPAddr of the Peer ProxyFS instance serving the matching volume

func (*Server) RpcLease

func (s *Server) RpcLease(in *LeaseRequest, reply *LeaseReply) (err error)

RpcLease is called to either request a Shared|Exclusive Lease or to Promote|Demote|Release a granted Shared|Exclusive|either Lease.

func (s *Server) RpcLink(in *LinkRequest, reply *Reply) (err error)

func (*Server) RpcLinkPath

func (s *Server) RpcLinkPath(in *LinkPathRequest, reply *Reply) (err error)

func (*Server) RpcListXAttr

func (s *Server) RpcListXAttr(in *ListXAttrRequest, reply *ListXAttrReply) (err error)

func (*Server) RpcListXAttrPath

func (s *Server) RpcListXAttrPath(in *ListXAttrPathRequest, reply *ListXAttrReply) (err error)

func (*Server) RpcLog

func (s *Server) RpcLog(in *LogRequest, reply *Reply) (err error)

func (*Server) RpcLookup

func (s *Server) RpcLookup(in *LookupRequest, reply *InodeReply) (err error)

func (*Server) RpcLookupPath

func (s *Server) RpcLookupPath(in *LookupPathRequest, reply *InodeReply) (err error)

func (*Server) RpcLookupPlus

func (s *Server) RpcLookupPlus(in *LookupPlusRequest, reply *LookupPlusReply) (err error)

func (*Server) RpcMiddlewareMkdir

func (s *Server) RpcMiddlewareMkdir(in *MiddlewareMkdirReq, reply *MiddlewareMkdirReply) (err error)

Makes a directory. Unlike RpcMkdir, one can invoke this with just a path.

func (*Server) RpcMkdir

func (s *Server) RpcMkdir(in *MkdirRequest, reply *InodeReply) (err error)

func (*Server) RpcMkdirPath

func (s *Server) RpcMkdirPath(in *MkdirPathRequest, reply *Reply) (err error)

func (*Server) RpcMountByAccountName

func (s *Server) RpcMountByAccountName(in *MountByAccountNameRequest, reply *MountByAccountNameReply) (err error)

func (*Server) RpcMountByVolumeName

func (s *Server) RpcMountByVolumeName(in *MountByVolumeNameRequest, reply *MountByVolumeNameReply) (err error)

func (*Server) RpcPing

func (s *Server) RpcPing(in *PingReq, reply *PingReply) (err error)

func (*Server) RpcPost

func (s *Server) RpcPost(in *MiddlewarePostReq, reply *MiddlewarePostReply) (err error)

RpcPost handles a POST command from middleware for an account, container or object.

func (*Server) RpcProvisionObject

func (s *Server) RpcProvisionObject(in *ProvisionObjectRequest, reply *ProvisionObjectReply) (err error)

func (*Server) RpcPutComplete

func (s *Server) RpcPutComplete(in *PutCompleteReq, reply *PutCompleteReply) (err error)

RpcPutComplete is used by PUT HTTP request once data has been put in Swift.

Sets up inode, etc.

func (*Server) RpcPutContainer

func (s *Server) RpcPutContainer(in *PutContainerReq, reply *PutContainerReply) (err error)

RpcPutContainer creates or updates a container (top-level directory).

func (*Server) RpcPutLocation

func (s *Server) RpcPutLocation(in *PutLocationReq, reply *PutLocationReply) (err error)

RpcPutLocation is used by PUT HTTP request to provision an object so that middleware can PUT the object in Swift.

Later, a RpcPutComplete() will be called to setup inode, etc.

func (s *Server) RpcReadSymlink(in *ReadSymlinkRequest, reply *ReadSymlinkReply) (err error)

func (*Server) RpcReadSymlinkPath

func (s *Server) RpcReadSymlinkPath(in *ReadSymlinkPathRequest, reply *ReadSymlinkReply) (err error)

func (*Server) RpcReaddir

func (s *Server) RpcReaddir(in *ReaddirRequest, reply *ReaddirReply) (err error)

func (*Server) RpcReaddirByLoc

func (s *Server) RpcReaddirByLoc(in *ReaddirByLocRequest, reply *ReaddirReply) (err error)

func (*Server) RpcReaddirPlus

func (s *Server) RpcReaddirPlus(in *ReaddirPlusRequest, reply *ReaddirPlusReply) (err error)

func (*Server) RpcReaddirPlusByLoc

func (s *Server) RpcReaddirPlusByLoc(in *ReaddirPlusByLocRequest, reply *ReaddirPlusReply) (err error)

func (*Server) RpcReleaseLease

func (s *Server) RpcReleaseLease(in *ReleaseLeaseReq, reply *ReleaseLeaseReply) (err error)

Release a lease, allowing a file's log segments to be deleted when necessary.

Middleware calls this once an object GET response is complete.

func (*Server) RpcRemoveXAttr

func (s *Server) RpcRemoveXAttr(in *RemoveXAttrRequest, reply *Reply) (err error)

func (*Server) RpcRemoveXAttrPath

func (s *Server) RpcRemoveXAttrPath(in *RemoveXAttrPathRequest, reply *Reply) (err error)

func (*Server) RpcRename

func (s *Server) RpcRename(in *RenameRequest, reply *Reply) (err error)

func (*Server) RpcRenamePath

func (s *Server) RpcRenamePath(in *RenamePathRequest, reply *Reply) (err error)

func (*Server) RpcRenewLease

func (s *Server) RpcRenewLease(in *RenewLeaseReq, reply *RenewLeaseReply) (err error)

Renew a lease, ensuring that the related file's log segments won't get deleted. This ensures that an HTTP client is able to complete an object GET request regardless of concurrent FS writes or HTTP PUTs to that file.

Middleware calls this periodically while producing an object GET response.

func (*Server) RpcResize

func (s *Server) RpcResize(in *ResizeRequest, reply *Reply) (err error)

func (*Server) RpcRmdir

func (s *Server) RpcRmdir(in *UnlinkRequest, reply *Reply) (err error)

func (*Server) RpcRmdirPath

func (s *Server) RpcRmdirPath(in *UnlinkPathRequest, reply *Reply) (err error)

func (*Server) RpcSetTime

func (s *Server) RpcSetTime(in *SetTimeRequest, reply *Reply) (err error)

func (*Server) RpcSetTimePath

func (s *Server) RpcSetTimePath(in *SetTimePathRequest, reply *Reply) (err error)

func (*Server) RpcSetXAttr

func (s *Server) RpcSetXAttr(in *SetXAttrRequest, reply *Reply) (err error)

func (*Server) RpcSetXAttrPath

func (s *Server) RpcSetXAttrPath(in *SetXAttrPathRequest, reply *Reply) (err error)

func (*Server) RpcSetstat

func (s *Server) RpcSetstat(in *SetstatRequest, reply *Reply) (err error)

func (*Server) RpcSnapShotCreate

func (s *Server) RpcSnapShotCreate(in *SnapShotCreateRequest, reply *SnapShotCreateReply) (err error)

func (*Server) RpcSnapShotDelete

func (s *Server) RpcSnapShotDelete(in *SnapShotDeleteRequest, reply *SnapShotDeleteReply) (err error)

func (*Server) RpcSnapShotListByID

func (s *Server) RpcSnapShotListByID(in *SnapShotListRequest, reply *SnapShotListReply) (err error)

func (*Server) RpcSnapShotListByName

func (s *Server) RpcSnapShotListByName(in *SnapShotListRequest, reply *SnapShotListReply) (err error)

func (*Server) RpcSnapShotListByTime

func (s *Server) RpcSnapShotListByTime(in *SnapShotListRequest, reply *SnapShotListReply) (err error)

func (*Server) RpcSnapShotLookupByName

func (s *Server) RpcSnapShotLookupByName(in *SnapShotLookupByNameRequest, reply *SnapShotLookupByNameReply) (err error)

func (*Server) RpcStatVFS

func (s *Server) RpcStatVFS(in *StatVFSRequest, reply *StatVFS) (err error)
func (s *Server) RpcSymlink(in *SymlinkRequest, reply *InodeReply) (err error)

func (*Server) RpcSymlinkPath

func (s *Server) RpcSymlinkPath(in *SymlinkPathRequest, reply *Reply) (err error)

func (*Server) RpcType

func (s *Server) RpcType(in *TypeRequest, reply *TypeReply) (err error)
func (s *Server) RpcUnlink(in *UnlinkRequest, reply *Reply) (err error)

func (*Server) RpcUnlinkPath

func (s *Server) RpcUnlinkPath(in *UnlinkPathRequest, reply *Reply) (err error)

func (*Server) RpcUnmount

func (s *Server) RpcUnmount(in *UnmountRequest, reply *Reply) (err error)

func (*Server) RpcWrote

func (s *Server) RpcWrote(in *WroteRequest, reply *WroteReply) (err error)

type SetTimePathRequest

type SetTimePathRequest struct {
	PathHandle
	StatStruct
}

SetTimePathRequest is the request object for RpcSetTimePath.

type SetTimeRequest

type SetTimeRequest struct {
	InodeHandle
	StatStruct
}

SetTimeRequest is the request object for RpcSetTime.

type SetXAttrPathRequest

type SetXAttrPathRequest struct {
	PathHandle
	AttrName  string
	AttrValue []byte
	AttrFlags int
}

type SetXAttrRequest

type SetXAttrRequest struct {
	InodeHandle
	AttrName  string
	AttrValue []byte
	AttrFlags int
}

type SetstatRequest

type SetstatRequest struct {
	InodeHandle
	StatStruct
}

SetstatRequest is the request object for RpcSetstat.

type SnapShotCreateReply

type SnapShotCreateReply struct {
	SnapShotID uint64
}

SnapShotCreateReply is the reply object for RpcSnapShotCreate

type SnapShotCreateRequest

type SnapShotCreateRequest struct {
	MountID MountIDAsString
	Name    string
}

SnapShotCreateRequest is the request object for RpcSnapShotCreate

type SnapShotDeleteReply

type SnapShotDeleteReply struct{}

SnapShotDeleteReply is the reply object for RpcSnapShotDelete

type SnapShotDeleteRequest

type SnapShotDeleteRequest struct {
	MountID    MountIDAsString
	SnapShotID uint64
}

SnapShotDeleteRequest is the request object for RpcSnapShotDelete

type SnapShotListReply

type SnapShotListReply struct {
	List []headhunter.SnapShotStruct
}

SnapShotListReply is the reply object for RpcSnapShotListBy{ID|Name|Time}

type SnapShotListRequest

type SnapShotListRequest struct {
	MountID  MountIDAsString
	Reversed bool
}

SnapShotListRequest is the request object for RpcSnapShotListBy{ID|Name|Time}

type SnapShotLookupByNameReply

type SnapShotLookupByNameReply struct {
	SnapShot headhunter.SnapShotStruct
}

SnapShotLookupByNameReply is the reply object for RpcSnapShotLookupByName

type SnapShotLookupByNameRequest

type SnapShotLookupByNameRequest struct {
	MountID MountIDAsString
	Name    string
}

SnapShotLookupByNameRequest is the request object for RpcSnapShotLookupByName

type StatStruct

type StatStruct struct {
	CTimeNs         uint64
	CRTimeNs        uint64
	MTimeNs         uint64
	ATimeNs         uint64
	Size            uint64
	NumLinks        uint64
	StatInodeNumber int64
	FileMode        uint32
	UserID          uint32
	GroupID         uint32
}

StatStruct is used when stats need to be conveyed. It is used as the response to RpcGetStat and RpcGetStatPath, as well as in RpcSetStat and RpcReaddirPlus.

Note that times are conveyed as nanoseconds since epoch.

type StatVFS

type StatVFS struct {
	BlockSize      uint64
	FragmentSize   uint64
	TotalBlocks    uint64
	FreeBlocks     uint64
	AvailBlocks    uint64
	TotalInodes    uint64
	FreeInodes     uint64
	AvailInodes    uint64
	FileSystemID   uint64
	MountFlags     uint64
	MaxFilenameLen uint64
}

StatVFS is used when filesystem stats need to be conveyed. It is used by RpcStatVFS.

type StatVFSRequest

type StatVFSRequest struct {
	MountID MountIDAsString
}

StatVFSRequest is the request object for RpcStatVFS.

type SymlinkPathRequest

type SymlinkPathRequest struct {
	PathHandle
	TargetFullpath string
	UserID         int32
	GroupID        int32
}

SymlinkPathRequest is the request object for RpcSymlinkPath.

type SymlinkRequest

type SymlinkRequest struct {
	InodeHandle
	Basename string
	Target   string
	UserID   int32
	GroupID  int32
}

SymlinkRequest is the request object for RpcSymlink.

type TypeReply

type TypeReply struct {
	FileType uint16
}

TypeReply is the reply object for RpcType.

FileType here will be a uint16 containing DT_DIR|DT_REG|DT_LNK.

type TypeRequest

type TypeRequest struct {
	InodeHandle
}

TypeRequest is the request object for RpcType.

type UnlinkPathRequest

type UnlinkPathRequest struct {
	PathHandle
}

UnlinkPathRequest is the request object for RpcUnlinkPath & RpcRmdirPath.

type UnlinkRequest

type UnlinkRequest struct {
	InodeHandle
	Basename string
}

UnlinkRequest is the request object for RpcUnlink & RpcRmdir.

type UnmountRequest

type UnmountRequest struct {
	MountID MountIDAsString
}

UnmountRequest is the request object for RpcUnmount.

Note that all leases are implicitly released as part of servicing this request.

type WroteReply

type WroteReply struct {
}

type WroteRequest

type WroteRequest struct {
	InodeHandle
	ContainerName string
	ObjectName    string
	FileOffset    []uint64
	ObjectOffset  []uint64
	Length        []uint64
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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