Ejemplo n.º 1
0
    async def add(self, name, info):

        if self.queues.get(name) is not None:
            mesg = f'A queue already exists with the name {name}.'
            raise s_exc.DupName(mesg=mesg, name=name)

        self.queues.set(name, info)
        self.sizes.set(name, 0)
        self.offsets.set(name, 0)
Ejemplo n.º 2
0
    def add(self, name, info):

        if self.queues.get(name) is not None:
            mesg = f'A queue exists with the name {name}.'
            raise s_exc.DupName(mesg=mesg, name=name)

        item = self.queues.get(name)
        if item is None:
            self.queues.set(name, info)
            self.sizes.set(name, 0)
            self.offsets.set(name, 0)
Ejemplo n.º 3
0
    async def _methQueueAdd(self, name):

        self.runt.reqAllowed(('storm', 'queue', 'add'))

        info = self.runt.snap.core.multiqueue.queues.get(name)
        if info is not None:
            mesg = f'A queue named {name} already exists.'
            raise s_exc.DupName(mesg=mesg)

        info = {'user': self.runt.user.iden, 'time': s_common.now()}
        self.runt.snap.core.multiqueue.add(name, info)

        return Queue(self.runt, name, info)