summaryrefslogtreecommitdiff
path: root/view/sharedcache/api
diff options
context:
space:
mode:
Diffstat (limited to 'view/sharedcache/api')
-rw-r--r--view/sharedcache/api/python/sharedcache.py13
-rw-r--r--view/sharedcache/api/python/sharedcache_enums.py6
-rw-r--r--view/sharedcache/api/sharedcache.cpp2
-rw-r--r--view/sharedcache/api/sharedcacheapi.h2
-rw-r--r--view/sharedcache/api/sharedcachecore.h8
5 files changed, 25 insertions, 6 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
diff --git a/view/sharedcache/api/sharedcache.cpp b/view/sharedcache/api/sharedcache.cpp
index a0c4e961..d9838057 100644
--- a/view/sharedcache/api/sharedcache.cpp
+++ b/view/sharedcache/api/sharedcache.cpp
@@ -102,7 +102,7 @@ namespace SharedCacheAPI {
{
BackingCache cache;
cache.path = value[i].path;
- cache.isPrimary = value[i].isPrimary;
+ cache.cacheType = value[i].cacheType;
for (size_t j = 0; j < value[i].mappingCount; j++)
{
BackingCacheMapping mapping;
diff --git a/view/sharedcache/api/sharedcacheapi.h b/view/sharedcache/api/sharedcacheapi.h
index 712cc98e..af82bb62 100644
--- a/view/sharedcache/api/sharedcacheapi.h
+++ b/view/sharedcache/api/sharedcacheapi.h
@@ -105,7 +105,7 @@ namespace SharedCacheAPI {
struct BackingCache {
std::string path;
- bool isPrimary;
+ BNBackingCacheType cacheType;
std::vector<BackingCacheMapping> mappings;
};
diff --git a/view/sharedcache/api/sharedcachecore.h b/view/sharedcache/api/sharedcachecore.h
index c2e1c7bd..54899919 100644
--- a/view/sharedcache/api/sharedcachecore.h
+++ b/view/sharedcache/api/sharedcachecore.h
@@ -64,6 +64,12 @@ extern "C"
LoadProgressFinished,
} BNDSCViewLoadProgress;
+ typedef enum BNBackingCacheType {
+ BackingCacheTypePrimary,
+ BackingCacheTypeSecondary,
+ BackingCacheTypeSymbols,
+ } BNBackingCacheType;
+
typedef struct BNBinaryView BNBinaryView;
typedef struct BNSharedCache BNSharedCache;
typedef struct BNStringRef BNStringRef;
@@ -98,7 +104,7 @@ extern "C"
typedef struct BNDSCBackingCache {
char* path;
- bool isPrimary;
+ BNBackingCacheType cacheType;
BNDSCBackingCacheMapping* mappings;
size_t mappingCount;
} BNDSCBackingCache;