Exemplo n.º 1
0
    def __init__(self,
                 flux_handle,
                 topic,
                 payload=None,
                 nodeid=flux.FLUX_NODEID_ANY,
                 flags=0,
                 handle=None):
      self.external = False
      if handle is not None:
        self.external = True
      else:
        if isinstance(flux_handle, Wrapper):
          flux_handle = flux_handle.handle

        if payload is None:
          payload = ffi.NULL
        elif payload != ffi.NULL and not isinstance(payload, basestring):
          payload = json.dumps(payload)

        if isinstance(nodeid, basestring):
          # String version is multiple nodeids
          handle = lib.flux_rpc_multi(flux_handle, topic, payload, nodeid, flags)
        else:
          handle = lib.flux_rpc(flux_handle, topic, payload, nodeid, flags)

      
      super(self.__class__, self).__init__(ffi, lib, 
                                       handle=handle,
                                       match=ffi.typeof(lib.flux_rpc).result,
                                       prefixes=[
                                         'flux_rpc_',
                                         ],
                                       )
Exemplo n.º 2
0
 def __init__(self, handle=None):
     super(self.__class__, self).__init__(ffi, lib,
                                          handle=handle,
                                          match=ffi.typeof(
                                              lib.flux_sec_create).result,
                                          prefixes=['flux_sec_'],
                                          destructor=lib.flux_sec_destroy,)
     if handle is None:
         self.handle = lib.flux_sec_create()
Exemplo n.º 3
0
 def __init__(self, handle=None):
   if handle is None:
     self.external = False
     handle = lib.flux_sec_create(type_id)
   else:
     self.external = True
   super(self.__class__, self).__init__(ffi, lib, 
                                    handle=handle,
                                    match=ffi.typeof(lib.flux_sec_create).result,
                                    prefixes=['flux_sec_'],
                                    )
Exemplo n.º 4
0
 def __init__(self, handle=None):
     super(self.__class__, self).__init__(
         ffi,
         lib,
         handle=handle,
         match=ffi.typeof(lib.flux_sec_create).result,
         prefixes=['flux_sec_'],
         destructor=lib.flux_sec_destroy,
     )
     if handle is None:
         self.handle = lib.flux_sec_create()
Exemplo n.º 5
0
    def __init__(self, url=ffi.NULL, flags=0, handle=None):
        super(self.__class__, self).__init__(
            ffi,
            lib,
            handle=handle,
            match=ffi.typeof(lib.flux_open).result,
            filter_match=False,
            prefixes=["flux_", "FLUX_"],
            destructor=raw.flux_close,
        )

        if handle is None:
            self.handle = raw.flux_open(url, flags)
Exemplo n.º 6
0
 def __init__(self, handle=None):
     if handle is None:
         self.external = False
         handle = lib.flux_sec_create(type_id)
     else:
         self.external = True
     super(self.__class__, self).__init__(
         ffi,
         lib,
         handle=handle,
         match=ffi.typeof(lib.flux_sec_create).result,
         prefixes=['flux_sec_'],
     )
Exemplo n.º 7
0
    def __init__(self, url=ffi.NULL, flags=0, handle=None):
        super(self.__class__, self).__init__(
            ffi,
            lib,
            handle=handle,
            match=ffi.typeof(lib.flux_open).result,
            filter_match=False,
            prefixes=[
                'flux_',
                'FLUX_',
            ],
            destructor=raw.flux_close,
        )

        if handle is None:
            self.handle = raw.flux_open(url, flags)
Exemplo n.º 8
0
    def __init__(self, url=ffi.NULL, flags=0, handle=None):
        self.external = True
        self.handle = None

        if handle is None:
            handle = raw.flux_open(url, flags)
            self.external = False

        super(self.__class__, self).__init__(
            ffi, lib,
            handle=handle,
            match=ffi.typeof(lib.flux_open).result,
            filter_match=False,
            prefixes=[
                'flux_',
                'FLUX_',
            ], )
Exemplo n.º 9
0
        def __init__(self,
                     flux_handle,
                     topic,
                     payload=None,
                     nodeid=flux.FLUX_NODEID_ANY,
                     flags=0,
                     handle=None):
            self.external = False
            if handle is not None:
                self.external = True
            else:
                if isinstance(flux_handle, Wrapper):
                    flux_handle = flux_handle.handle

                if payload is None:
                    payload = ffi.NULL
                elif payload != ffi.NULL and not isinstance(
                        payload, basestring):
                    payload = json.dumps(payload)

                if isinstance(nodeid, basestring):
                    # String version is multiple nodeids
                    handle = lib.flux_rpc_multi(flux_handle, topic, payload,
                                                nodeid, flags)
                else:
                    handle = lib.flux_rpc(flux_handle, topic, payload, nodeid,
                                          flags)

            super(self.__class__, self).__init__(
                ffi,
                lib,
                handle=handle,
                match=ffi.typeof(lib.flux_rpc).result,
                prefixes=[
                    'flux_rpc_',
                ],
            )