OpenFAM Reference Implementation

openfam::fam::fam_backup

backup data from one FAM-resident data item to an archival storage.

Synopsis

void *fam_backup(Fam_Descriptor *src, const char *BackupName, Fam_Backup_Options *backupOptions);

Description

Initiates a backup operation of data from a FAM-resident data item to an archival storage.

Input Arguments

Name Description
src Descriptor associated with the source data item in FAM.
BackupName Name of the backup.
backupOptions backup related info like retention period, etc.

Return Values

Returns a pointer to the wait object for the backup operation. This object can be used to wait for the completion of the backup operation. Throws Fam_Exception on error.

Fam Error Numbers

ErrorDescription
FAM_ERR_INVALIDAPI called with incorrect parameters.
FAM_ERR_NOPERMCaller does not have access rights
FAM_ERR_OUTOFRANGEData access out of range.
FAM_ERR_LIBFABRICLibfabric error occurred.
FAM_ERR_RPCCommunication error from grpc layer.
FAM_ERR_RPC_CLIENT_NOTFOUNDRPC service not available.
FAM_ERR_METADATAMetadata service error.
FAM_ERR_MEMORYMemory service error.
FAM_ERR_RESOURCEResource not available.
FAM_BACKUP_NOT_CREATEDBackup creation failed.

Notes

Note that the method is non-blocking: it returns after the backup has been initiated, and does not wait for completion of the transfer. Also note that fam_backup() performs an inconsistent backup, in that the backed up data may reflect updates that are performed concurrently with the backup operation, rather than a point-in-time snapshot of the source data item that is consistent as of the beginning of backup operation. If the application desires a consistent backup, it is responsible for coordinating PE activity during the backup operation.

Example

#include <string.h>
#include <fam/fam.h>
#include <fam/fam_exception.h>
using namespace std;
using namespace openfam;
	
int main(void) {
	fam *myFam = new fam();
	
	// ... Initialization code here

	 try {
		// look up the descriptor to a previously allocated (source) data item.
		Fam_Descriptor *descriptor = myFam->fam_lookup("myItem", "myRegion");
		
		// name of backup for given data item.
		char *backupName = (char *)malloc(FILE_MAX_LEN);
		sprintf(backupName, "%s.%s", "myRegion", "myItem");
		
		// Backup options, if any, can be provided here.
		Fam_Backup_Options *backupOptions =
		(Fam_Backup_Options *)malloc(sizeof(Fam_Backup_Options));
		

		// Initiates backup of given data item and returns a waitObject to backup operation.
		void *waitObj = myFam->fam_backup(descriptor, backupName, backupOptions);
	
		// Wait for backup operation to complete.
		myFam->fam_backup_wait(waitObj);
		printf("Backup of data item is successful\n");
	 } catch (Fam_Exception &e) {
		printf("fam API failed: %d: %s\n", e.fam_error(), e.fam_error_msg());
	 }
	
	 // ... subsequent code here
}