SAFplus Runtime Director API  3.0.5
aspCheckpoint.Table Class Reference

Interface to ASP Checkpointing Service functionality User would create a Table object on which he can do read and write. More...

Public Member Functions

def __init__
 Constructor function for the Table class. More...
 
def ErrorHandler
 Function to handle the common error codes returned by ASP functions. More...
 
def SetAutoActivate
 Set the global value of autoActivate to given value. More...
 
def Activate
 Set the active replica for the asynchronous checkpoints. More...
 
def Synchronize
 Synchronize checkpoint replicas. More...
 
def Delete
 Delete the section of the checkpointed denoted by given key. More...
 
def Read
 Read the checkpoint for the given section ids. More...
 
def Write
 Write data into the table. More...
 
def GetActiveStatus
 Get the active status of the checkpoint. More...
 

Public Attributes

 ckptName
 
 flags
 
 retentionMs
 
 maxSections
 
 maxSectionSizeBytes
 
 maxSectionIdSizeBytes
 
 sectionExpiration
 
 autoActivate
 
 tryAgainDelayMs
 
 svcHdl
 
 ckptHdl
 

Detailed Description

Interface to ASP Checkpointing Service functionality User would create a Table object on which he can do read and write.

Constructor & Destructor Documentation

def aspCheckpoint.Table.__init__ (   self,
  name,
  maxRows,
  maxRowSizeBytes,
  maxRowKeySizeBytes,
  flagsp = asp.SA_CKPT_WR_ALL_REPLICAS,
  retentionMs = asp.SA_TIME_MAX 
)

Constructor function for the Table class.

It creats a new checkpoint with the given parameters.

Parameters
nameName of the table/checkpoint to be created
flagspThis parameter indicates the type of checkpoint to be created. The supported values are: SA_CKPT_WR_ALL_REPLICAS, SA_CKPT_WR_ACTIVE_REPLICA, SA_CKPT_WR_ACTIVE_REPLICA_WEAK, SA_CKPT_CHECKPOINT_COLLOCATED. The meaning of these flags are as below:

SA_CKPT_WR_ALL_REPLICAS - Creates a checkpoint with synchronous update option SA_CKPT_WR_ACTIVE_REPLICA - Creates a checkpoint with the asynchronous update option and providing atomicity when updating the replicas SA_CKPT_WR_ACTIVE_REPLICA_WEAK - Creates a checkpoint with the asynchronous update option but there is no guarantee of atomicity with updating the replicas. SA_CKPT_CHECKPOINT_COLLOCATED - If this flag is specified at the creation time, there is no active replica created until user explicitly sets an Active replica for the checkpoint.

For more details about these flags and their usage, refer to SAF Checkpoint Service specification.

Parameters
retentionMsRetention time indicates that any checkpoint that is inactive for this duration will automatically deleted by the checkpoint service
maxSectionsMaximum number of checkpoints for this checkpoint
maxSectionSizeBytesMaximum size of each section
maxSectionIdSizeBytesMaximum length of the section identifier.

Member Function Documentation

def aspCheckpoint.Table.Activate (   self)

Set the active replica for the asynchronous checkpoints.

def aspCheckpoint.Table.Delete (   self,
  key 
)

Delete the section of the checkpointed denoted by given key.

Parameters
keyString identifier for the checkpoint section
def aspCheckpoint.Table.ErrorHandler (   self,
  s,
  e 
)

Function to handle the common error codes returned by ASP functions.

Parameters
sString description for the exception
eException caught from invoking the ASP APIs
def aspCheckpoint.Table.GetActiveStatus (   self)

Get the active status of the checkpoint.

Returns
Returns the boolean value indicating the status of the checkpoint
def aspCheckpoint.Table.Read (   self,
  keys 
)

Read the checkpoint for the given section ids.

Parameters
keysA list of section ids or keys
Returns
data Returns the data stored in the given sections
def aspCheckpoint.Table.SetAutoActivate (   self,
  val = True 
)

Set the global value of autoActivate to given value.

Default being True When autoActivate is set to True, the library will take care of setting the Active repliaca for the asynchronous checkpoints. Otherwise, user will have to explicitly activate the replica using Activate() function.

Parameters
valBoolean value indicate whether to enable auto activate or not
def aspCheckpoint.Table.Synchronize (   self,
  timeout = asp.SA_TIME_END 
)

Synchronize checkpoint replicas.

Parameters
timeoutTimeout to wait for the completion of the update from the checkpoint service
def aspCheckpoint.Table.Write (   self,
  keyOrContainer,
  data = None 
)

Write data into the table.

There are several ways to call this functions: Write("rowname","data"): Writes the value "data" into the row named "rowname" (will TRUNCATE the existing record if new record is shorter) Write([("rowname","data"),("rowname2","data2")]): List of tuples format (will NOT truncate the existing record) Write({"rowname":"data","rowname2":"data2"}): Dictionary format (will NOT truncate)

Parameters
keyOrContainerEither a string, in which case this is interpreted as the row (section) identifier, and "data" will be the data to write OR a container of key/data pairs (see the function discription for formats)
dataThis is the data to write into the row if key is a string, otherwise this is NOT USED.

Member Data Documentation

aspCheckpoint.Table.autoActivate
aspCheckpoint.Table.ckptHdl
aspCheckpoint.Table.ckptName
aspCheckpoint.Table.flags
aspCheckpoint.Table.maxSectionIdSizeBytes
aspCheckpoint.Table.maxSections
aspCheckpoint.Table.maxSectionSizeBytes
aspCheckpoint.Table.retentionMs
aspCheckpoint.Table.sectionExpiration
aspCheckpoint.Table.svcHdl
aspCheckpoint.Table.tryAgainDelayMs