api.proto 3.3 KB
Newer Older
1 2 3 4
syntax = 'proto3';

package v1alpha1;

J
jiazhiguang 已提交
5
// Cache represents the metadata of a cache managed by enclave pool.
6
message Cache {
J
jiazhiguang 已提交
7
    // Type represents the type of enclave pool
8
    string type = 1;
J
jiazhiguang 已提交
9
    // ID represents the id of the cache and the id is unique in the same type of enclave pool
10 11 12 13 14 15 16 17 18 19 20
    string ID = 2;
    // SavePath represents the absolute path to store the cache
    string savePath = 3;
    // Parent represents the parent cache of the current cache, if do not have a parent the value is nil
    Cache parent = 4;
    // Size represents the size in bytes of the cache
    int64 size = 5;
    // Created represents the creation time of the cache which is the number of seconds elapsed since January 1, 1970 UTC
    int64 created = 6;
}

J
jiazhiguang 已提交
21 22
// EnclavePoolManager represents an enclave pool
service EnclavePoolManager {
23 24 25 26 27 28 29 30 31 32 33 34 35 36
    // GetCache represents get the specified cache metadata
    rpc GetCache(GetCacheRequest) returns (GetCacheResponse) {}
    // SaveCache represents save the data to a cache directory and record the cache metadata
    rpc SaveCache(SaveCacheRequest) returns (SaveCacheResponse) {}
    // ListCache represents list part of or all of the cache metadata
    rpc ListCache(ListCacheRequest) returns (ListCacheResponse) {}
    // DeleteCache represents delete the specified cached data and remove the corresponding cache metadata
    rpc DeleteCache(DeleteCacheRequest) returns (DeleteCacheResponse) {}
    // LoadCache represents load the specified cache data to work directory
    rpc LoadCache(LoadCacheRequest) returns (LoadCacheResponse) {}
}

// GetCacheRequest
message GetCacheRequest {
J
jiazhiguang 已提交
37
    // Type represents the type of enclave pool
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
    string type = 1;
    // ID represents the id of the cache
    string ID = 2;
}

message GetCacheResponse {
    // Cache represents the response cache metadata
    Cache cache = 1;
}

message SaveCacheRequest {
    // Cache represents the cache metadata needs to be saved
    Cache cache = 1;
    // SourcePath represents the absolute path of source cache data
    string sourcePath = 2;
}

message SaveCacheResponse {
    // Ok represents whether the cache is saved successfully
    bool ok = 1;
}

message ListCacheRequest {
J
jiazhiguang 已提交
61
    // Type represents the type of enclave pool
62 63 64 65 66 67 68 69 70 71 72 73 74 75
    string type = 1;
    // LastCacheID represents the id of the last cache metadata in the most recent query list,
    // if the value is "", query the cache metadata from the starting point of DB,
    // otherwise query the cache metadata starting from the next id of `lastCacheID` in alphabetical order
    string lastCacheID = 2;
    // Limit represents the maximum number of queried entries
    int32 limit = 3;
}
message ListCacheResponse {
    // Caches represents the list of response caches
    repeated Cache caches = 1;
}

message DeleteCacheRequest {
J
jiazhiguang 已提交
76
    // Type represents the type of enclave pool
77 78 79 80 81 82 83 84 85 86
    string type = 1;
    // ID represents the id of the cache
    string ID = 2;
}
message DeleteCacheResponse {
    // Ok represents whether the cache is deleted successfully
    bool ok = 1;
}

message LoadCacheRequest {
J
jiazhiguang 已提交
87
    // Type represents the type of enclave pool
88 89 90 91 92 93 94 95 96 97
    string type = 1;
    // ID represents the id of the cache
    string ID = 3;
    // TargetPath represents the work directory for loading the cache data
    string targetPath = 4;
}
message LoadCacheResponse {
    // Ok represents whether the cache is loaded successfully
    bool ok = 1;
}