summaryrefslogtreecommitdiff
path: root/view/sharedcache/api/python
diff options
context:
space:
mode:
authorWeiN76LQh <WeiN76LQh@github.com>2024-11-28 18:52:19 +0000
committerMason Reed <mason@vector35.com>2025-02-17 21:05:02 -0500
commit9fa3dd7b2f00fe2e988e319d3fdb83ee99e30cd0 (patch)
tree525177007cf41ddb69150955d462d5a51bbdd7c5 /view/sharedcache/api/python
parenta30831a814503b75a1fa6efeea1cd0a673c240d7 (diff)
[SharedCache] Define BackingCacheType
Split out from https://github.com/WeiN76LQh/binaryninja-api/tree/process-local-symbols
Diffstat (limited to 'view/sharedcache/api/python')
-rw-r--r--view/sharedcache/api/python/sharedcache.py13
-rw-r--r--view/sharedcache/api/python/sharedcache_enums.py6
2 files changed, 16 insertions, 3 deletions
diff --git a/view/sharedcache/api/python/sharedcache.py b/view/sharedcache/api/python/sharedcache.py
index e0e18bde..e3ccbb9b 100644
--- a/view/sharedcache/api/python/sharedcache.py
+++ b/view/sharedcache/api/python/sharedcache.py
@@ -52,14 +52,21 @@ class DSCBackingCacheMapping:
@dataclasses.dataclass
class DSCBackingCache:
path: str
- isPrimary: bool
+ cacheType: BackingCacheType
mappings: list[DSCBackingCacheMapping]
def __str__(self):
return repr(self)
def __repr__(self):
- return f"<DSCBackingCache {self.path} {'Primary' if self.isPrimary else 'Secondary'} | {len(self.mappings)} mappings>"
+ match self.cacheType:
+ case BackingCacheType.BackingCacheTypePrimary:
+ cacheTypeStr = 'Primary'
+ case BackingCacheType.BackingCacheTypeSecondary:
+ cacheTypeStr = 'Secondary'
+ case BackingCacheType.BackingCacheTypeSymbols:
+ cacheTypeStr = 'Symbols'
+ return f"<DSCBackingCache {self.path} {cacheTypeStr} | {len(self.mappings)} mappings>"
@dataclasses.dataclass
@@ -142,7 +149,7 @@ class SharedCache:
mappings.append(mapping)
result.append(DSCBackingCache(
value[i].path,
- value[i].isPrimary,
+ value[i].cacheType,
mappings
))
diff --git a/view/sharedcache/api/python/sharedcache_enums.py b/view/sharedcache/api/python/sharedcache_enums.py
index 34668424..ea86b5c6 100644
--- a/view/sharedcache/api/python/sharedcache_enums.py
+++ b/view/sharedcache/api/python/sharedcache_enums.py
@@ -1,6 +1,12 @@
import enum
+class BackingCacheType(enum.IntEnum):
+ BackingCacheTypePrimary = 0
+ BackingCacheTypeSecondary = 1
+ BackingCacheTypeSymbols = 2
+
+
class DSCViewLoadProgress(enum.IntEnum):
LoadProgressNotStarted = 0
LoadProgressLoadingCaches = 1