From 4a49ba509bdc0b4ffa650fc8461738c2085161c7 Mon Sep 17 00:00:00 2001 From: Mason Reed Date: Sun, 13 Jul 2025 14:39:14 -0400 Subject: [WARP] Add network container This is going to be disabled by default on this upcoming stable, however users may enable it once we deploy the public server. The data from the server is done through `Container::fetch_functions` independent of the nonblocking function lookup functions. The sidebar has been updated to drive fetching so that when users navigate to a new function the fetcher will kick off. This fetcher operates on a separate thread, in the event of a user navigating to many functions before the current fetch has completed they all will be batched together in a single fetch. Networked container currently is limited to just function prototypes, other type information separate from the function object will be omitted. --- plugins/warp/api/python/_warpcore.py | 23 +++++++++++++++++++++++ plugins/warp/api/python/warp.py | 7 +++++++ 2 files changed, 30 insertions(+) (limited to 'plugins/warp/api/python') diff --git a/plugins/warp/api/python/_warpcore.py b/plugins/warp/api/python/_warpcore.py index 740072ab..da262f18 100644 --- a/plugins/warp/api/python/_warpcore.py +++ b/plugins/warp/api/python/_warpcore.py @@ -204,6 +204,29 @@ def BNWARPContainerCommitSource( return _BNWARPContainerCommitSource(container, source) +# ------------------------------------------------------- +# _BNWARPContainerFetchFunctions + +_BNWARPContainerFetchFunctions = core.BNWARPContainerFetchFunctions +_BNWARPContainerFetchFunctions.restype = None +_BNWARPContainerFetchFunctions.argtypes = [ + ctypes.POINTER(BNWARPContainer), + ctypes.POINTER(BNWARPTarget), + ctypes.POINTER(BNWARPTypeGUID), + ctypes.c_ulonglong, + ] + + +# noinspection PyPep8Naming +def BNWARPContainerFetchFunctions( + container: ctypes.POINTER(BNWARPContainer), + target: ctypes.POINTER(BNWARPTarget), + guids: ctypes.POINTER(BNWARPTypeGUID), + count: int + ) -> None: + return _BNWARPContainerFetchFunctions(container, target, guids, count) + + # ------------------------------------------------------- # _BNWARPContainerGetFunctionsWithGUID diff --git a/plugins/warp/api/python/warp.py b/plugins/warp/api/python/warp.py index c761c323..c7486b8c 100644 --- a/plugins/warp/api/python/warp.py +++ b/plugins/warp/api/python/warp.py @@ -305,6 +305,13 @@ class WarpContainer(metaclass=_WarpContainerMetaclass): core_guids[i] = guids[i].uuid return warpcore.BNWARPContainerRemoveTypes(self.handle, source.uuid, core_guids, count) + def fetch_functions(self, target: WarpTarget, guids: List[FunctionGUID]): + count = len(guids) + core_guids = (warpcore.BNWARPFunctionGUID * count)() + for i in range(count): + core_guids[i] = guids[i].uuid + warpcore.BNWARPContainerFetchFunctions(self.handle, target.handle, core_guids, count) + def get_sources_with_function_guid(self, target: WarpTarget, guid: FunctionGUID) -> List[Source]: count = ctypes.c_size_t() sources = warpcore.BNWARPContainerGetSourcesWithFunctionGUID(self.handle, target.handle, guid.uuid, count) -- cgit v1.3.1