Commit f0dbe1c4 authored by Cristiano Urban's avatar Cristiano Urban
Browse files

Added support for 'sticky' flag. Thanks to Massimo Sponza for the suggestion.

parent 9ceac8f1
Loading
Loading
Loading
Loading
+15 −1
Original line number Diff line number Diff line
@@ -256,6 +256,20 @@ class DbConnector(object):
                (value, nodeVOSPath,))
            self.conn.commit()
    
    def setSticky(self, nodeVOSPath, value):
        """Sets the 'sticky' flag for a VOSpace node."""
        if self.conn:
            self.cursor.execute("""
                UPDATE node SET sticky = %s                                                                                        
                WHERE path <@
                (SELECT path
                 FROM node_path p
                 JOIN node n ON p.node_id = n.node_id
                 WHERE p.vos_path = %s);
                """,
                (value, nodeVOSPath,))
            self.conn.commit()
    
    def setBusyState(self, nodeVOSPath, value):
        """Sets the 'busy_state' flag for a VOSpace node."""
        if self.conn:
+4 −0
Original line number Diff line number Diff line
@@ -13,6 +13,7 @@ class Node(object):
        self.locationId = None
        self.format = None
        self.transferType = None
        self.sticky = None
        self.busyState = None
        self.ownerID = None
        self.creatorID = None
@@ -68,6 +69,9 @@ class Node(object):
    def setTransferType(self, transferType):
        self.transferType = transferType
        
    def setSticky(self, sticky):
        self.sticky = sticky

    def setBusyState(self, busyState):
        self.busyState = busyState

+1 −0
Original line number Diff line number Diff line
@@ -78,6 +78,7 @@ class StoreExecutor(TaskExecutor):
        self.dbConn.connect()
        for nodeVOSPath in self.nodeList:
            self.dbConn.setAsyncTrans(nodeVOSPath, True);
            self.dbConn.setSticky(nodeVOSPath, True);
            self.dbConn.setBusyState(nodeVOSPath, False);
        self.dbConn.disconnect()