imgrpkg

package
v0.0.0-...-dd0c44f Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2022 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Overview

Package imgrpkg implements the server side Inode Management for ProxyFS volumes. While the package provides a small set of Go-callable APIs, the bulk of its functionality is accessed via package retryrpc-exposed RPCs. While these RPCs reference active volumes known to an imgrpkg instance, a RESTful API is provided to specify those active volumes.

Note that func's listed under type RetryRPCServerStruct are the RPCs issued by the client side via package retryrpc connections (and, thus, not intended to be called directly).

To configure an imgrpkg instance, Start() is called passing, as the sole argument, a package conf ConfMap. Here is a sample .conf file:

[IMGR]
PublicIPAddr:                         imgr
PrivateIPAddr:                        imgr
RetryRPCPort:                         32356
HTTPServerPort:                       15346

CheckPointIPAddrs:                           # List of ickpt cluster instance IPAddr's
CheckPointPort:                       33123  # Only required if CheckPointIPAddrs is non-empty
CheckPointCACertFilePath:                    # Defaults to /dev/null disabling TLS
CheckPointRetryDelay:                 100ms  # Only required if CheckPointIPAddrs is non-empty
CheckPointRetryExpBackoff:            2      # Only required if CheckPointIPAddrs is non-empty
CheckPointRetryLimit:                 4      # Only required if CheckPointIPAddrs is non-empty
CheckPointTimeout:                    10m    # Only required if CheckPointIPAddrs is non-empty
CheckPointConnectionPoolSize:         10     # Only required if CheckPointIPAddrs is non-empty

RetryRPCTTLCompleted:                 10m
RetryRPCAckTrim:                      100ms
RetryRPCDeadlineIO:                   60s
RetryRPCKeepAlivePeriod:              60s

RetryRPCCertFilePath:                        # If both RetryRPC{Cert|Key}FilePath are missing or empty,
RetryRPCKeyFilePath:                         #   non-TLS RetryRPC will be selected; otherwise TLS will be used

CheckPointInterval:                   10s

AuthTokenCheckInterval:               1m

FetchNonceRangeToReturn:              100

MountLimit:                           10000
OpenFileLimit:                        100000

MinLeaseDuration:                     250ms
LeaseInterruptInterval:               250ms
LeaseInterruptLimit:                  20
LeaseEvictLowLimit:                   100000
LeaseEvictHighLimit:                  100010

SwiftRetryDelay:                      100ms
SwiftRetryExpBackoff:                 2
SwiftRetryLimit:                      4

SwiftTimeout:                         10m
SwiftConnectionPoolSize:              128

ParallelObjectDeletePerVolumeLimit:   100

InodeTableCacheEvictLowLimit:         10000
InodeTableCacheEvictHighLimit:        10010

InodeTableMaxInodesPerBPlusTreePage:  2048
RootDirMaxDirEntriesPerBPlusTreePage: 1024

LogFilePath:                                 # imgr.log
LogToConsole:                         true   # false
TraceEnabled:                         false
RetryRPCLogEnabled:                   false

Most of the config keys are required and must have values. One exception is LogFilePath that will default to "" and, hence, cause logging to not go to a file. This might typically be used when LogToConsole is set to true.

The RetryRPC{Cert|Key}FilePath keys are optional and, if provided may be empty. In such cases, the retryrpc package will be configured to use TCP. If, however, they are present and provide a path or paths to valid Cert|Key files, the retryrpc package will be configured to use TLS. In any event, the RPCs will be available via <PublicIPAddr>:<RetryRPCPort>.

The RESTful API is provided by an embedded HTTP Server (at URL http://<PrivateIPAddr>:<HTTPServerPort>) responds to the following:

DELETE /keepalive

This will disable the keep alive mechanism.

DELETE /volume/<volumeName>

This will cause the specified <volumeName> to no longer be served. Note that this does not actually affect the contents of the associated Container.

GET /config

This will return a JSON document that matches the conf.ConfMap used to launch this package.

GET /keepalive

This will return the configured keepalive duration if any. If the keepalive mechanism has not been enabled, a 404 Not Found will be returned. If the keepalive mechanism has been enabled, this is the highest performing way to reset the countdown timer.

GET /stats

This will return a raw bucketstats dump.

GET /version

This will return the imgr version.

GET /volume

This will return a JSON document containing an array of volumes currently being served with details about each.

GET /volume/<volumeName>

This will return a JSON document containing only the specified <volumeName> details (assuming it is currently being served).

POST /volume
Content-Type: application/json

{
   "StorageURL": "http://172.28.128.2:8080/v1/AUTH_test/con",
   "AuthToken" : "AUTH_tk0123456789abcde0123456789abcdef0"
}

This will cause the specified StorageURL to be formatted. The StorageURL specified in the JSON document content identifies the Container for format. The AuthToken in the JSON document content provides the authentication to use during the formatting process.

PUT /keepalive/<duration>

This will configure the keep alive mechanism to start a count down timer for the specified duration after which all served volumes will no longer be served. The expiration of this count down timer can be avoided by GET-ing (/keepalive) the current duration, PUT-ing (/keepalive/<duration) a fresh keep alive duration, GET-ing (/volume) the list of volumes currently served, PUT-ing (/volume/<volumeName>) a new volume, or by DELETE-ing (/keepalive) the keep alive mechanism. Note that if tje keep alive mechanism ever expired, the current duratiom will be reset to zero (i.e. no expiration).

PUT /volume/<volumeName>
Content-Type: application/json

{
   "StorageURL": "http://172.28.128.2:8080/v1/AUTH_test/con"
}

This will cause the specified <volumeName> to be served. The StorageURL specified in the JSON document content identifies the Container to serve. Clients will each supply an AuthToken in their Mount/RenewMount requests that will be used to access the Container.

PUT /volume/<volumeName>
Content-Type: application/json

{
   "StorageURL": "http://172.28.128.2:8080/v1/AUTH_test/con",
   "AuthToken" : "AUTH_tk0123456789abcde0123456789abcdef0"
}

This will cause the specified <volumeName> to be served. The StorageURL specified in the JSON document content identifies the Container to serve. Clients will each supply an AuthToken in their Mount/RenewMount requests that will be used to access the Container. As a debugging aid, and in the case where no Clients have <volumeName> mounted, the AuthToken in the JSON document content will be used to access the Container.

Index

Constants

View Source
const (
	EAuthTokenRejected      = "EAuthTokenRejected:"
	EBadOpenCountAdjustment = "EBadOpenCountAdjustment:"
	ELeaseRequestDenied     = "ELeaseRequestDenied:"
	EMissingLease           = "EMissingLease:"
	ETooManyMounts          = "ETooManyMounts"
	ETooManyOpens           = "ETooManyOpens"
	EVolumeBeingDeleted     = "EVolumeBeingDeleted:"
	EUnknownInodeNumber     = "EUnknownInodeNumber:"
	EUnknownMountID         = "EUnknownMountID:"
	EUnknownVolumeName      = "EUnknownVolumeName:"
)

E* specifies the prefix of an error string returned by any RetryRPC API

Variables

This section is empty.

Functions

func LogInfof

func LogInfof(format string, args ...interface{})

LogInfof is a wrapper around the internal logInfof() func called by imgr/main.go::main().

func LogWarnf

func LogWarnf(format string, args ...interface{})

LogWarnf is a wrapper around the internal logWarnf() func called by imgr/main.go::main().

func Signal

func Signal() (err error)

Signal is called to interrupt the server for performing operations such as log rotation.

func Start

func Start(confMap conf.ConfMap) (err error)

Start is called to start serving.

func Stop

func Stop() (err error)

Stop is called to stop serving.

Types

type AdjustInodeTableEntryOpenCountRequestStruct

type AdjustInodeTableEntryOpenCountRequestStruct struct {
	MountID     string
	InodeNumber uint64
	Adjustment  int64
}

AdjustInodeTableEntryOpenCountRequestStruct is the request object for AdjustInodeTableEntryOpenCount.

type AdjustInodeTableEntryOpenCountResponseStruct

type AdjustInodeTableEntryOpenCountResponseStruct struct{}

AdjustInodeTableEntryOpenCountResponseStruct is the response object for AdjustInodeTableEntryOpenCount.

type DeleteInodeTableEntryRequestStruct

type DeleteInodeTableEntryRequestStruct struct {
	MountID     string
	InodeNumber uint64
}

DeleteInodeTableEntryRequestStruct is the request object for DeleteInodeTableEntry.

type DeleteInodeTableEntryResponseStruct

type DeleteInodeTableEntryResponseStruct struct{}

DeleteInodeTableEntryResponseStruct is the response object for DeleteInodeTableEntry.

type FetchNonceRangeRequestStruct

type FetchNonceRangeRequestStruct struct {
	MountID string
}

FetchNonceRangeRequestStruct is the request object for FetchNonceRange.

Possible errors: EAuthTokenRejected EUnknownMountID

type FetchNonceRangeResponseStruct

type FetchNonceRangeResponseStruct struct {
	NextNonce        uint64
	NumNoncesFetched uint64
}

FetchNonceRangeResponseStruct is the response object for FetchNonceRange.

type FlushRequestStruct

type FlushRequestStruct struct {
	MountID string
}

FlushRequestStruct is the request object for Flush.

type FlushResponseStruct

type FlushResponseStruct struct{}

FlushResponseStruct is the response object for Flush.

type GetInodeTableEntryRequestStruct

type GetInodeTableEntryRequestStruct struct {
	MountID     string
	InodeNumber uint64
}

GetInodeTableEntryRequestStruct is the request object for GetInodeTableEntry.

type GetInodeTableEntryResponseStruct

type GetInodeTableEntryResponseStruct struct {
	InodeHeadObjectNumber uint64
	InodeHeadLength       uint64
}

GetInodeTableEntryResponseStruct is the response object for GetInodeTableEntry.

type LeaseRequestStruct

type LeaseRequestStruct struct {
	MountID          string
	InodeNumber      uint64
	LeaseRequestType // One of LeaseRequestType*
}

LeaseRequestStruct is the request object for Lease.

func (*LeaseRequestStruct) String

func (leaseRequest *LeaseRequestStruct) String() (str string)

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 LeaseResponseStruct

type LeaseResponseStruct struct {
	LeaseResponseType // One of LeaseResponseType*
}

LeaseResponseStruct is the response object for Lease.

func (*LeaseResponseStruct) String

func (leaseResponse *LeaseResponseStruct) String() (str string)

type LeaseResponseType

type LeaseResponseType uint32

LeaseResponseType 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 (
	LeaseResponseTypeDenied    LeaseResponseType = iota // Request denied (e.g. Promotion deadlock avoidance)
	LeaseResponseTypeShared                             // SharedLease granted
	LeaseResponseTypePromoted                           // SharedLease promoted to ExclusiveLease
	LeaseResponseTypeExclusive                          // ExclusiveLease granted
	LeaseResponseTypeDemoted                            // ExclusiveLease demoted to SharedLease
	LeaseResponseTypeReleased                           // SharedLease or ExclusiveLease released
)

type MountRequestStruct

type MountRequestStruct struct {
	VolumeName string
	AuthToken  string
}

MountRequestStruct is the request object for Mount.

type MountResponseStruct

type MountResponseStruct struct {
	MountID string
}

MountResponseStruct is the response object for Mount.

type PutInodeTableEntriesRequestStruct

type PutInodeTableEntriesRequestStruct struct {
	MountID                                  string
	UpdatedInodeTableEntryArray              []PutInodeTableEntryStruct
	SuperBlockInodeObjectCountAdjustment     int64
	SuperBlockInodeBytesWrittenAdjustment    int64
	SuperBlockInodeBytesReferencedAdjustment int64
	DereferencedObjectNumberArray            []uint64
}

PutInodeTableEntriesRequestStruct is the request object for PutInodeTableEntries (which must have an active Exclusive Lease for every PutInodeTableEntryStruct.InodeNumber granted to the MountID).

The SuperBlockInode{ObjectCount|BytesWritten|BytesReferenced}Adjustment fields are used to update the corresponding fields in the volume's SuperBlock.

Note that dereferenced objects listed in the DereferencedObjectNumberArray will not be deleted until the next CheckPoint is performed.

type PutInodeTableEntriesResponseStruct

type PutInodeTableEntriesResponseStruct struct{}

PutInodeTableEntriesResponseStruct is the response object for PutInodeTableEntries.

type PutInodeTableEntryStruct

type PutInodeTableEntryStruct struct {
	InodeNumber           uint64
	InodeHeadObjectNumber uint64
	InodeHeadLength       uint64
}

PutInodeTableEntryStruct is used to indicate the change to an individual InodeTableEntry as part of the collection of changes in a PutInodeTablesEntries request (which must have an active Exclusive Lease granted to the MountID).

type RPCInterrupt

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

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

func (*RPCInterrupt) String

func (rpcInterrupt *RPCInterrupt) String() (str string)

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 RenewMountRequestStruct

type RenewMountRequestStruct struct {
	MountID   string
	AuthToken string
}

RenewMountRequestStruct is the request object for RenewMount.

type RenewMountResponseStruct

type RenewMountResponseStruct struct{}

RenewMountResponseStruct is the response object for RenewMount.

type RetryRPCServerStruct

type RetryRPCServerStruct struct{}

func (*RetryRPCServerStruct) AdjustInodeTableEntryOpenCount

func (dummy *RetryRPCServerStruct) AdjustInodeTableEntryOpenCount(adjustInodeTableEntryOpenCountRequest *AdjustInodeTableEntryOpenCountRequestStruct, adjustInodeTableEntryOpenCountResponse *AdjustInodeTableEntryOpenCountResponseStruct) (err error)

AdjustInodeTableEntryOpenCount requests the specified Inode's OpenCount be adjusted. If the referenced InodeNumber is non-zero, a (Shared or Exclusive) Lease must be granted to the MountID. If the adjustment results in an OpenCount of zero and the Inode has been marked for deletion by a prior call to DeleteInodeTableEntry, the Inode will be deleted.

Possible errors: EAuthTokenRejected EBadOpenCountAdjustment EMissingLease EUnknownMountID

func (*RetryRPCServerStruct) DeleteInodeTableEntry

func (dummy *RetryRPCServerStruct) DeleteInodeTableEntry(deleteInodeTableEntryRequest *DeleteInodeTableEntryRequestStruct, deleteInodeTableEntryResponse *DeleteInodeTableEntryResponseStruct) (err error)

DeleteInodeTableEntry requests the specified Inode information be deleted. An active Exclusive Lease must be granted to the MountID. Note that unless/until the OpenCount for the Inode drops to zero, the Inode will still exist.

Possible errors: EAuthTokenRejected EMissingLease EUnknownMountID

func (*RetryRPCServerStruct) FetchNonceRange

func (dummy *RetryRPCServerStruct) FetchNonceRange(fetchNonceRangeRequest *FetchNonceRangeRequestStruct, fetchNonceRangeResponse *FetchNonceRangeResponseStruct) (err error)

FetchNonceRange requests a range of uint64 nonce values (i.e. values that will never be reused).

Possible errors: EAuthTokenRejected EUnknownMountID

func (*RetryRPCServerStruct) Flush

func (dummy *RetryRPCServerStruct) Flush(flushRequest *FlushRequestStruct, flushResponse *FlushResponseStruct) (err error)

Flush that the results of prior PutInodeTableEntries requests be persisted.

Possible errors: EAuthTokenRejected EUnknownMountID

func (*RetryRPCServerStruct) GetInodeTableEntry

func (dummy *RetryRPCServerStruct) GetInodeTableEntry(getInodeTableEntryRequest *GetInodeTableEntryRequestStruct, getInodeTableEntryResponse *GetInodeTableEntryResponseStruct) (err error)

GetInodeTableEntry requests the Inode information for the specified Inode (which must have an active Shared or Exclusive Lease granted to the MountID).

Possible errors: EAuthTokenRejected EMissingLease EUnknownInodeNumber EUnknownMountID

func (*RetryRPCServerStruct) Lease

func (dummy *RetryRPCServerStruct) Lease(leaseRequest *LeaseRequestStruct, leaseResponse *LeaseResponseStruct) (err error)

Lease is a blocking Lease Request.

Possible errors: EAuthTokenRejected EUnknownMountID

func (*RetryRPCServerStruct) Mount

func (dummy *RetryRPCServerStruct) Mount(retryRPCClientID uint64, mountRequest *MountRequestStruct, mountResponse *MountResponseStruct) (err error)

Mount performs a mount of the specified Volume and returns a MountID to be used in all subsequent RPCs to reference this Volume by this Client.

Possible errors: EAuthTokenRejected EVolumeBeingDeleted EUnknownVolumeName

func (*RetryRPCServerStruct) PutInodeTableEntries

func (dummy *RetryRPCServerStruct) PutInodeTableEntries(putInodeTableEntriesRequest *PutInodeTableEntriesRequestStruct, putInodeTableEntriesResponse *PutInodeTableEntriesResponseStruct) (err error)

PutInodeTableEntries requests an atomic update of the listed Inodes (which must each have an active Exclusive Lease granted to the MountID).

Possible errors: EAuthTokenRejected EMissingLease EUnknownMountID

func (*RetryRPCServerStruct) RenewMount

func (dummy *RetryRPCServerStruct) RenewMount(renewMountRequest *RenewMountRequestStruct, renewMountResponse *RenewMountResponseStruct) (err error)

RenewMount updates the AuthToken for the specified MountID.

Possible errors: EAuthTokenRejected EUnknownMountID

func (*RetryRPCServerStruct) Unmount

func (dummy *RetryRPCServerStruct) Unmount(unmountRequest *UnmountRequestStruct, unmountResponse *UnmountResponseStruct) (err error)

Unmount requests that the given MountID be released (and implicitly releases any Leases held by the MountID).

Possible errors: EAuthTokenRejected EUnknownMountID

func (*RetryRPCServerStruct) VolumeStatus

func (dummy *RetryRPCServerStruct) VolumeStatus(volumeStatusRequest *VolumeStatusRequestStruct, volumeStatusResponse *VolumeStatusResponseStruct) (err error)

VolumeStatus requests the current status of the mounted volume.

Possible errors: EAuthTokenRejected EUnknownMountID

type UnmountRequestStruct

type UnmountRequestStruct struct {
	MountID string
}

UnmountRequestStruct is the request object for Unmount.

type UnmountResponseStruct

type UnmountResponseStruct struct{}

UnmountResponseStruct is the response object for Unmount.

type VolumeStatusRequestStruct

type VolumeStatusRequestStruct struct {
	MountID string
}

VolumeStatusRequestStruct is the request object for VolumeStatus.

type VolumeStatusResponseStruct

type VolumeStatusResponseStruct struct {
	NumInodes       uint64
	ObjectCount     uint64
	BytesWritten    uint64
	BytesReferenced uint64
}

VolumeStatusResponseStruct is the response object for VolumeStatus.

Jump to

Keyboard shortcuts

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