Grassroots Infrastructure
The Grassroots Infrastructure is a suite of computing tools to help users and developers use scientific data infrastructure that can easily be interconnected.
Handler Library

Utility code for accessing Handlers. More...

Data Structures

struct  Handler
 A Handler is a datatype for accessing data. More...
 
struct  HandlerNode
 A datatype for storing a Handler on a LinkedList. More...
 

Enumerations

enum  HandlerStatus { HS_GOOD, HS_FINISHED, HS_BAD, HS_NONE }
 An enumeration of the possible status values of a stream being used by a Handler. More...
 

Functions

HandlerGetResourceHandler (const DataResource *resource_p, struct GrassrootsServer *server_p, const User *user_p)
 Get the appropriate Handler for a given Resource. More...
 
bool InitHandlerUtil (void)
 This allocates the internal structures used by the Handler library. More...
 
bool DestroyHandlerUtil (void)
 This frees the internal structures used by the Handler library. More...
 
const char * GetMappedFilename (const char *protocol_s, const char *user_id_s, const char *filename_s, time_t *time_p)
 Create a local file for caching changes to a remote file allowing changes to be committed once editing has finished,. More...
 
bool SetMappedFilename (const char *protocol_s, const char *user_id_s, const char *filename_s, const char *mapped_filename_s, const time_t last_mod_time)
 Store the details of an external file and its locally-mapped copy. More...
 

Detailed Description

Utility code for accessing Handlers.

Enumeration Type Documentation

◆ HandlerStatus

An enumeration of the possible status values of a stream being used by a Handler.

Enumerator
HS_GOOD 

The stream is in a valid state.

HS_FINISHED 

The Handler has reached the end of the stream.

HS_BAD 

The Handler has encountered an error using the stream.

HS_NONE 

The Handler does not have an open stream.

Function Documentation

◆ GetResourceHandler()

Handler* GetResourceHandler ( const DataResource resource_p,
struct GrassrootsServer server_p,
const User user_p 
)

Get the appropriate Handler for a given Resource.

Parameters
resource_pThe Resource to get the Handler for.
user_pAn optional User for any user authentication if needed.
Returns
The matching Handler or NULL if none could be found.

◆ InitHandlerUtil()

bool InitHandlerUtil ( void  )

This allocates the internal structures used by the Handler library.

Returns
true upon success, false on failure.

◆ DestroyHandlerUtil()

bool DestroyHandlerUtil ( void  )

This frees the internal structures used by the Handler library.

Returns
true upon success, false on failure.

◆ GetMappedFilename()

const char* GetMappedFilename ( const char *  protocol_s,
const char *  user_id_s,
const char *  filename_s,
time_t *  time_p 
)

Create a local file for caching changes to a remote file allowing changes to be committed once editing has finished,.

Parameters
protocol_sThe protocol of the remote file.
user_id_sThe id of the current user. This can be NULL.
filename_sThe remote filename.
time_pThe time when the local cached file was created.
Returns
The local filename or NULL upon error.

◆ SetMappedFilename()

bool SetMappedFilename ( const char *  protocol_s,
const char *  user_id_s,
const char *  filename_s,
const char *  mapped_filename_s,
const time_t  last_mod_time 
)

Store the details of an external file and its locally-mapped copy.

Parameters
protocol_sThe protocol of the remote file.
user_id_sThe id of the current user. This can be NULL.
filename_sThe external filename of the file that is to be mapped.
mapped_filename_sThe local mapped filename.
last_mod_timeThe time that the local cached file was last modified.
Returns
true upon success, false on failure.