def __init__(self, blob_host_uri): """Initialize GridFS blob host. Args: blob_host_uri: MongoDB uri (mongodb://username:password@host:port/database) """ BLOBHost.__init__(self, blob_host_uri) try: # connect to mongo instance self.client = MongoClient( self.blob_host_uri, serverSelectionTimeoutMS=CONNECTION_TIMEOUT) # check connection self.client.server_info() # get database name from uri database_name = blob_host_uri.split("/")[-1] # connect to database self.database = self.client[database_name] # connect to gridfs self.fs = gridfs.GridFS(self.database) except Exception as e: raise BLOBError( "Unable to create the connection to the GridFS collection: %s" % str(e))
def __init__(self, blob_host_uri, blob_host_user, blob_host_password): """Initializes DSpace blob host Args: blob_host_uri: blob_host_user: blob_host_password: """ BLOBHost.__init__(self, blob_host_uri, blob_host_user, blob_host_password)
def query(self, query): """Query the blob collection - not implemented Args: query: Returns: """ BLOBHost.query(self)
def query(self, query): """Query the blob collection. Not yet implemented. Args: query: Returns: """ BLOBHost.query(self, query)
def query(self, query): BLOBHost.query(self)
def delete(self, handle): BLOBHost.delete(self)
def save(self, blob, filename=None): BLOBHost.save(self)
def list(self): BLOBHost.list(self)
def get(self, handle): BLOBHost.get(self)