Exemplo n.º 1
0
    def setRowsByIdProp(self, iden, prop, valu):
        '''
        Update or insert the value of the row(s) with iden and prop to valu.

        Args:
            iden (str): Iden to update.
            prop (str): Property to update.
            valu: Value to set.

        Examples:
            Set the foo=10 value on a given iden::



        Notes:
            This does fire a "core:save:set:rows:by:idprop" event on the
            savebus to save the changes which are being sent to the storage
            layer.

        Returns:
            None
        '''
        reqstor(prop, valu)
        self.savebus.fire('core:save:set:rows:by:idprop',
                          iden=iden,
                          prop=prop,
                          valu=valu)
        self._setRowsByIdProp(iden, prop, valu)
Exemplo n.º 2
0
    def addRows(self, rows):
        '''
        Add (iden, prop, valu, time) rows to the Storage object.

        Args:
            rows (list): List of rows containing (i, p, v, t) tuples.

        Examples:
            Adding a pair of rows to the storage object::

                import time
                tick = now()

                rows = [
                    (id1,'baz',30,tick),
                    (id1,'foo','bar',tick),
                ]

                store.addRows(rows)

        Notes:
            The general convention for the iden value is a 16 byte hex string,
            such as "e190d108bdd30a035a15764313f4c397". These can be made with
            the synapse.common.guid() function.  While the storage layer is
            free to STORE these idens however it sees fit, some tools may
            expect that, at the public row level APIs, idens may conform to
            that shape. If other types of idens are put into the system, that
            could cause unintentional issues.

            This does fire a "core:save:add:rows" event on the savebus to save
            the raw rows which are being send to the storage layer.

        Returns:
            None
        '''
        [reqstor(p, v) for (i, p, v, t) in rows]
        self.savebus.fire('core:save:add:rows', rows=rows)
        self._addRows(rows)