@@ -76,6 +76,84 @@ interface binding-cacher {
7676 }
7777}
7878
79+ interface dao-cacher {
80+ // Metadata associated with a batch of Ethereum logs.
81+ record dao-logs-metadata {
82+ chain-id : string ,
83+ from-block : string ,
84+ to-block : string ,
85+ time-created : string ,
86+ created-by : string ,
87+ signature : string ,
88+ }
89+
90+ // Represents an item in the manifest, detailing a single log cache file.
91+ record dao-manifest-item {
92+ metadata : dao-logs-metadata ,
93+ is-empty : bool ,
94+ file-hash : string ,
95+ file-name : string ,
96+ }
97+
98+ // The main manifest structure, listing all available log cache files.
99+ // WIT does not support direct map types, so a list of key-value tuples is used.
100+ record dao-manifest {
101+ // The key is the filename of the log cache.
102+ items : list <tuple <string , dao-manifest-item >>,
103+ manifest-filename : string ,
104+ chain-id : string ,
105+ protocol-version : string ,
106+ }
107+
108+ record dao-get-logs-by-range-request {
109+ from-block : u64 ,
110+ to-block : option <u64 >, // If None, signifies to the latest available/relevant cached block.
111+ }
112+
113+ variant dao-get-logs-by-range-ok-response {
114+ logs (tuple <u64 , string >),
115+ latest (u64 ),
116+ }
117+
118+ // Defines the types of requests that can be sent to the Hypermap Cacher process.
119+ variant dao-cacher-request {
120+ get-manifest ,
121+ get-log-cache-content (string ),
122+ get-status ,
123+ get-logs-by-range (dao-get-logs-by-range-request ),
124+ reset (option <list <string >>),
125+ start-providing ,
126+ stop-providing ,
127+ set-nodes (list <string >),
128+ }
129+
130+ // Represents the operational status of the cacher.
131+ record dao-cacher-status {
132+ last-cached-block : u64 ,
133+ chain-id : string ,
134+ protocol-version : string ,
135+ next-cache-attempt-in-seconds : option <u64 >,
136+ manifest-filename : string ,
137+ log-files-count : u32 ,
138+ our-address : string ,
139+ is-providing : bool ,
140+ }
141+
142+ // Defines the types of responses the Hypermap Cacher process can send.
143+ variant dao-cacher-response {
144+ get-manifest (option <dao-manifest >),
145+ get-log-cache-content (result <option <string >, string >),
146+ get-status (dao-cacher-status ),
147+ get-logs-by-range (result <dao-get-logs-by-range-ok-response , string >),
148+ start-providing (result <string , string >),
149+ stop-providing (result <string , string >),
150+ set-nodes (result <string , string >),
151+ reset (result <string , string >),
152+ rejected ,
153+ is-starting ,
154+ }
155+ }
156+
79157interface hypermap-cacher {
80158 // Metadata associated with a batch of Ethereum logs.
81159 record logs-metadata {
@@ -154,9 +232,10 @@ interface hypermap-cacher {
154232 }
155233}
156234
157- world hypermap-cacher-sys-v1 {
235+ world hypermap-cacher-sys-v2 {
158236 import sign ;
159237 import binding-cacher ;
238+ import dao-cacher ;
160239 import hypermap-cacher ;
161240 include process-v1 ;
162241}
0 commit comments