Droplet
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
Functions
Scality specific functions

Functions specific to Scality backends. More...

Functions

void dpl_scal_gc_gen_key (BIGNUM *id, int cl)
 Generate a GC key. More...
 
dpl_status_t dpl_scal_gc_index_init (dpl_dbuf_t **indexp)
 Creates and initialises a new dbuf which can be used to create a GC index. More...
 
dpl_status_t dpl_scal_gc_index_serialize (BIGNUM *chunkkey, uint64_t offset, uint64_t size, dpl_dbuf_t *buffer)
 Add an object ID to a GC index. More...
 
dpl_status_t dpl_uks_gen_key_raw (BIGNUM *id, uint32_t hash, uint64_t oid, uint32_t volid, uint8_t serviceid, uint32_t specific)
 Generate a UKS key from raw data. More...
 
dpl_status_t dpl_uks_gen_key_ext (BIGNUM *id, dpl_uks_mask_t mask, uint64_t oid, uint32_t volid, uint8_t serviceid, uint32_t specific)
 Set some fields in a binary UKS key. More...
 
dpl_status_t dpl_uks_gen_key (BIGNUM *id, uint64_t oid, uint32_t volid, uint8_t serviceid, uint32_t specific)
 Generate a binary UKS key. More...
 
dpl_status_t dpl_uks_set_class (BIGNUM *k, int cl)
 Set the class field in a UKS key. More...
 
dpl_status_t dpl_uks_set_replica (BIGNUM *k, int replica)
 Set the replica field in a UKS key. More...
 
dpl_status_t dpl_uks_bn2hex (const BIGNUM *id, char *id_str)
 Convert a binary UKS key to string form. More...
 

Detailed Description

This module contains utility functions for dealing with the Scality backend cloud provider.

Several of these functions deal with Scality's UKS (Universal Key Scheme) which is the binary object ID format used in Scality's RING software. UKS keys are 160 bits long and are divided into several fixed-length fields which encode specific information. Fields include:

You can store anything you like in the payload field, but a recommended format is to use the following bit fields.

Function Documentation

void dpl_scal_gc_gen_key ( BIGNUM *  id,
int  cl 
)

Generates into id a special UKS key which does not refer to an actual object but which can be used to invoke the Scality GC service. The object ID is stored in a BIGNUM structure, which you should create with BN_new() and free with BN_free().

To delete multiple objects in a single protocol call, use this GC key as the id parameter of a dpl_put_id() call, and pass the contents of a GC index as the PUT data. See dpl_scal_gc_index_init() for details on how to create a GC index.

Parameters
[out]idthe UKS key is returned here
clthe UKS class (e.g. 2)
dpl_status_t dpl_scal_gc_index_init ( dpl_dbuf_t **  indexp)

GC indexes are effectively a list of object IDs and can be used to delete multiple objects in a single API call. Individual object IDs can be added to the GC index by calling dpl_scal_gc_index_serialize().

You should free the dbuf using dpl_dbuf_free() when you have finished using it.

Parameters
[out]indexpon success, a new dbuf is returned here
Return values
DPL_SUCCESSon success, or
DPL_*a Droplet error code on failure
dpl_status_t dpl_scal_gc_index_serialize ( BIGNUM *  chunkkey,
uint64_t  offset,
uint64_t  size,
dpl_dbuf_t buffer 
)

Adds an object ID to a GC index. The GC index buffer should have been created using dpl_scal_gc_index_init(), the object ID chunkkey using dpl_uks_gen_key().

If this function returns failure, the GC index cannot be used and you should free it immediately using dpl_dbuf_free().

If the object is a part of a logical file at some higher level of abstraction, you may pass the byte range of the object within that logical file as offset and size, but this is not necessary.

Parameters
chunkkeythe binary UKS key to add, may not be NULL
offsetbyte offset in some logical file (optional)
sizebyte size in some logical file (optional)
bufferthe dbuf in which the GC index is being built, may not be NULL
Return values
DPL_SUCCESSon success, or
DPL_*a Droplet error code on failure
dpl_status_t dpl_uks_bn2hex ( const BIGNUM *  id,
char *  id_str 
)

Converts the binary UKS key in id to a string form in id_str. The string form is suitable for use as the id parameter of the RESTful functions such as dpl_put_id(). The binary key id is stored in a BIGNUM structure, which you should create with BN_new() and free with BN_free().

Parameters
idthe binary UKS key
[out]id_stron success the string form is written here, must be at least DPL_UKS_BCH_LEN+1 bytes long
Return values
DPL_SUCCESSon success, or
DPL_*a Droplet error code on failure
dpl_status_t dpl_uks_gen_key ( BIGNUM *  id,
uint64_t  oid,
uint32_t  volid,
uint8_t  serviceid,
uint32_t  specific 
)

Sets all the fields in a binary UKS key and automatically calculates the hashing/dispersion field. You should also call dpl_uks_set_class() to set the class field. The binary key id is stored in a BIGNUM structure, which you should create with BN_new() and free with BN_free().

Parameters
idthe binary UKS key
oidwill be used as the Object ID field
volidwill be used as the Volume ID field
serviceidwill be used as the Service ID field
specificwill be used as the Application Specific field
Return values
DPL_SUCCESSon success, or
DPL_*a Droplet error code on failure
dpl_status_t dpl_uks_gen_key_ext ( BIGNUM *  id,
dpl_uks_mask_t  mask,
uint64_t  oid,
uint32_t  volid,
uint8_t  serviceid,
uint32_t  specific 
)

Sets some fields in a binary UKS key, according to a mask of which fields to set. Fields not specified in the mask are preserved. Automatically recalculates the hashing/dispersion field. You should also call dpl_uks_set_class() to set the class field. The binary key id is stored in a BIGNUM structure, which you should create with BN_new() and free with BN_free().

Parameters
idthe binary UKS key
maska bitmask of the following values indicating which fields to set
  • DPL_UKS_MASK_OID use the oid parameter as the Object ID field
  • DPL_UKS_MASK_VOLID use the volid parameter as the Volume ID field
  • DPL_UKS_MASK_SERVICEID use the parameter as the Service ID field
  • DPL_UKS_MASK_SPECIFIC use the parameter as the Application Specific field.
oidwill be used as the Object ID field if DPL_UKS_MASK_OID is present in mask
volidwill be used as the Volume ID field if DPL_UKS_MASK_VOLID is present in mask
serviceidwill be used as the Service ID field if DPL_UKS_MASK_SERVICEID is present in mask
specificwill be used as the Application Specific field if DPL_UKS_MASK_SPECIFIC is present in mask
Return values
DPL_SUCCESSon success, or
DPL_*a Droplet error code on failure
dpl_status_t dpl_uks_gen_key_raw ( BIGNUM *  id,
uint32_t  hash,
uint64_t  oid,
uint32_t  volid,
uint8_t  serviceid,
uint32_t  specific 
)

Generates a binary UKS key in id using raw data for each of the bitfields in the generic format. Note the class and replica fields should be set separately using dpl_uks_set_class() and dpl_uks_set_replica(). The binary key id is stored in a BIGNUM structure, which you should create with BN_new() and free with BN_free().

Only use this function if you know what you are doing. Note particularly that this function requires you to calculate and set the hashing/dispersion field yourself. For most applications you should use either dpl_uks_gen_key_ext() or dpl_uks_gen_key() which will calculate the hashing/dispersion field for you.

Parameters
idthe binary UKS key will be generated here
hashwill be used as the hashing/dispersion field
oidwill be used as the Object ID field
volidwill be used as the Volume ID field
serviceidwill be used as the Service ID field
specificwill be used as the Application Specific field
Return values
DPL_SUCCESSthis function currently cannot fail
dpl_status_t dpl_uks_set_class ( BIGNUM *  k,
int  cl 
)

Set the class field in a UKS key. The binary key id is stored in a BIGNUM structure, which you should create with BN_new() and free with BN_free().

Parameters
kthe binary UKS key
clwill be used as the class field
Return values
DPL_SUCCESSon success, or
DPL_*a Droplet error code on failure
dpl_status_t dpl_uks_set_replica ( BIGNUM *  k,
int  replica 
)

Set the replica field in a UKS key. The binary key id is stored in a BIGNUM structure, which you should create with BN_new() and free with BN_free().

Parameters
kthe binary UKS key
replicawill be used as the replica field
Return values
DPL_SUCCESSon success, or
DPL_*a Droplet error code on failure