Skip to content
This repository has been archived by the owner on Jan 17, 2022. It is now read-only.

API Overview

hojo edited this page Sep 28, 2012 · 1 revision

The Droplet library includes common operations and three separate API layers for different application protocols.

General Droplet library operations include:

  • Common context operations
  • Basic pricing operations

Common context operations

Context initialization functions

  • dpl_init() Initializes the Droplet library.
  • dpl_free() Releases the library.
  • dpl_ctx_new() Initializes a new context.
  • dpl_ctx_free() Releases a context.
  • dpl_status_str() Retuns an error or success message.

Context initialization parameters

  • droplet_dir The droplet directory.
  • profile_name The droplet profile name.
  • ctx The droplet context.

Context initialization prototypes

dpl_status_t 
dpl_init(void);

void 
dpl_free(void);

dpl_ctx_t 
*dpl_ctx_new(const char *droplet_dir, const char *profile_name);

void 
dpl_ctx_free(dpl_ctx_t *ctx);

Basic pricing operations

Pricing operation functions

  • dpl_price_storage() Returns the price for a specified amount of storage based on rates defined in the pricing file.
  • dpl_price_storage_str() Returns the price for a specified amount of storage as a string for easier display purposes.

Pricing parameters

  • size Amount of storage in bytes.

Pricing prototypes

double 
dpl_price_storage(dpl_ctx_t *ctx, 
                   size_t size);

char 
*dpl_price_storage_str(dpl_ctx_t *ctx, 
                       size_t size);

Layer APIs

The Droplet library API is split into 3 layers:

  • REST API: The common ground between all REST services
  • ID API: ID based access
  • VFS API: Path based access