Advertisement
chuckwegrzyn

Ladon Service Module

Jan 29th, 2012
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 4.28 KB | None | 0 0
  1. # -*- coding: iso-8859-1 -*-
  2. # Import standard Python libraries
  3. import logging
  4. from exceptions import Exception
  5.  
  6. # Third party libraries.
  7. try:
  8.     from ladon.ladonizer import ladonize
  9.     from ladon.types.ladontype import LadonType,attachment
  10.     from ladon.exceptions.service import ServiceFault
  11.     from ladon.compat import PORTABLE_STRING
  12. except ImportError,e:
  13.     logging.exception(e)
  14.     raise
  15.  
  16. class TSSFault(ServiceFault):
  17.     def __init__(self,faultstring,detail=None,stack_depth=2):
  18.         super(ServerFault,self).__init__('TSS',faultstring,detail,stack_depth)
  19.  
  20. class statusItem(LadonType):
  21.     host = PORTABLE_STRING
  22.     tid = int
  23.     nonce = PORTABLE_STRING
  24.     oid = PORTABLE_STRING
  25.     state = PORTABLE_STRING
  26.     extra = PORTABLE_STRING
  27.     flags = int
  28.     ipAddr = PORTABLE_STRING
  29.  
  30. class retrieveItem(LadonType):
  31.     nonce = PORTABLE_STRING
  32.     result = PORTABLE_STRING
  33.     object = attachment
  34.  
  35. class storeItem(LadonType):
  36.     nonce = PORTABLE_STRING
  37.     oid = PORTABLE_STRING
  38.  
  39. class findItem(LadonType):
  40.     host = PORTABLE_STRING
  41.     speed = int
  42.     tids =  [ int ]
  43.  
  44. class searchItem(LadonType):
  45.     tid = int
  46.     oid = PORTABLE_STRING
  47.     match = PORTABLE_STRING
  48.  
  49. class metaItem(LadonType):
  50.     item = PORTABLE_STRING
  51.     value = PORTABLE_STRING
  52.  
  53. class keyword(LadonType):
  54.     key = PORTABLE_STRING
  55.     value = PORTABLE_STRING
  56.  
  57.  
  58. class TSSClass(object):
  59.     """
  60.    The class that makes the SOAP services for the TSS
  61.    """
  62.  
  63.     @ladonize(rtype=PORTABLE_STRING)
  64.     def shutdown(self):
  65.         """ Shutdown the system, gracefully"""
  66.  
  67.         # Shutdown the soap server.
  68.         pass
  69.  
  70.     @ladonize(rtype=PORTABLE_STRING)
  71.     def version(self):
  72.         """ Return the version of the system."""
  73.         pass
  74.  
  75.  
  76.     @ladonize(int,PORTABLE_STRING,rtype=PORTABLE_STRING)
  77.     def removeObject(self,tid,oid):
  78.         """ Force the end-of-life indicator for the object (tid,OID) to be tomorrow."""
  79.         pass
  80.  
  81.  
  82.     @ladonize([int],PORTABLE_STRING,rtype = findItem)
  83.     def findObjects(self,ListOfTids,oid):
  84.         """ Find all the tenants from a list of tenants that have a particular OID."""
  85.         pass
  86.  
  87.     @ladonize(int,PORTABLE_STRING,rtype = PORTABLE_STRING)
  88.     def getStorageMap(self,tid,oid):
  89.         """ Return the storage map for a particular (tid,oid)."""
  90.         pass
  91.    
  92.     @ladonize(int,[PORTABLE_STRING],rtype = [statusItem])
  93.     def status(self,tid,ListOfNonces):
  94.         """ Return status information for tenant, tid, for a list of nonces.
  95.            The nonce names can be wildcarded using regexp patterns."""
  96.         pass
  97.  
  98.     @ladonize(PORTABLE_STRING,int,PORTABLE_STRING,PORTABLE_STRING,PORTABLE_STRING,rtype = retrieveItem)
  99.     def retrieveObject(self,Nonce,tid,oid,How,ipaddr):
  100.         """ Return the contents of object (tid,OID), returning the data How."""
  101.         pass
  102.  
  103.     @ladonize([int],PORTABLE_STRING,PORTABLE_STRING,rtype = [searchItem])
  104.     def searchObject(self,ListOfTids,oid,searchString):
  105.         """Search the system looking for a specific object in which the
  106.            search string matches."""
  107.         pass
  108.  
  109.     @ladonize(int,int,[int], rtype = [metaItem])
  110.     def searchMetadata(self,tid,oid,whatList):
  111.         """ Return the metadata, in whatList, for object (tid,OID)."""
  112.         pass
  113.  
  114.     @ladonize(int,PORTABLE_STRING,[metaItem],rtype=str)
  115.     def addMetadata(self,tid,oid,metaArray):
  116.         """ Add metaadata to an object's space. """
  117.         pass
  118.  
  119.     @ladonize(int,PORTABLE_STRING,rtype=PORTABLE_STRING)
  120.     def indexObject(self,tid,oid):
  121.         """Index the contents of a file, which must be in the system."""
  122.         pass
  123.  
  124.     @ladonize(PORTABLE_STRING,int,PORTABLE_STRING,PORTABLE_STRING,[int],[PORTABLE_STRING],
  125.               [PORTABLE_STRING],attachment,PORTABLE_STRING,PORTABLE_STRING,rtype=storeItem)
  126.     def storeObject(self,Nonce,tid,oid,HashRef,equivTidList,HomePeers,StorePeers,ObjectData,eol,ipaddr):
  127.         """Store an object in the repository"""
  128.         pass
  129.  
  130.     @ladonize(PORTABLE_STRING,int,PORTABLE_STRING,[int],                         [int],PORTABLE_STRING,PORTABLE_STRING,PORTABLE_STRING,rtype=storeItem)
  131.     def storeRef(self,Nonce,tid,oid,HomePeers,StorePeers,RefData,eol,ipaddr):
  132.         """Store an reference to something in the repository"""
  133.         pass
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement