antd 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +143 -9
- data/lib/antd/client.rb +242 -0
- data/lib/antd/errors.rb +133 -4
- data/lib/antd/grpc_client.rb +192 -1
- data/lib/antd/grpc_manifests.rb +128 -0
- data/lib/antd/manifests.rb +300 -0
- data/lib/antd/models.rb +221 -0
- data/lib/antd/v1/data_pb.rb +1 -1
- data/lib/antd/v1/manifests_pb.rb +22 -0
- data/lib/antd/v1/manifests_services_pb.rb +39 -0
- data/lib/antd/v1/pointers_pb.rb +38 -0
- data/lib/antd/v1/pointers_services_pb.rb +59 -0
- data/lib/antd/version.rb +1 -1
- data/lib/antd.rb +2 -0
- metadata +8 -2
data/lib/antd/models.rb
CHANGED
|
@@ -195,4 +195,225 @@ module Antd
|
|
|
195
195
|
end
|
|
196
196
|
alias_method :is_meta, :meta?
|
|
197
197
|
end
|
|
198
|
+
|
|
199
|
+
# One +payments+ quote in full signed form, returned by +pointer_prepare+
|
|
200
|
+
# when called with +include_signed_quotes: true+. +quote+ and
|
|
201
|
+
# +commitment_sidecar+ are opaque base64 strings on both transports (the
|
|
202
|
+
# gRPC client encodes the proto's bytes the same way); only antd parses
|
|
203
|
+
# them. +commitment_sidecar+ is nil for baseline quotes.
|
|
204
|
+
SignedQuoteEntry = Struct.new(:quote_hash, :quote, :commitment_sidecar, keyword_init: true)
|
|
205
|
+
|
|
206
|
+
# --- Pointers (ADR-0016 / ADR-0018 in ant-node) ---
|
|
207
|
+
#
|
|
208
|
+
# A pointer is a small, owner-signed, mutable reference. Its address is
|
|
209
|
+
# derived from the owner's key and never changes; what it points at (a
|
|
210
|
+
# chunk, such as a public file's data map, or another pointer) can be
|
|
211
|
+
# changed by the owner, and the owner can hand it over to another pointer
|
|
212
|
+
# for good. antd signs with owner keys it loaded at startup
|
|
213
|
+
# (+--pointer-keys+), so a write names the pointer by its address (+owner+),
|
|
214
|
+
# never by a key.
|
|
215
|
+
#
|
|
216
|
+
# Every write pays, and every attempt pays again: never retry a create,
|
|
217
|
+
# update, transfer or finalize automatically.
|
|
218
|
+
|
|
219
|
+
# Counter of a pointer's final state, after a transfer or a freeze:
|
|
220
|
+
# 2^64 - 1 (u64::MAX). Nothing can replace a state at this counter.
|
|
221
|
+
POINTER_FINAL_COUNTER = 18_446_744_073_709_551_615
|
|
222
|
+
|
|
223
|
+
# What a pointer's target is. Pass as +kind:+ to the pointer writes; the
|
|
224
|
+
# daemon defaults to +CHUNK+ when it is omitted.
|
|
225
|
+
module PointerKind
|
|
226
|
+
# An immutable chunk, such as a public file's data map. The default.
|
|
227
|
+
CHUNK = "chunk"
|
|
228
|
+
# Another pointer: a forwarding the owner can still change. Use
|
|
229
|
+
# +pointer_transfer+ to hand a pointer over for good.
|
|
230
|
+
POINTER = "pointer"
|
|
231
|
+
|
|
232
|
+
# The kind a raw +kind_tag+ names (0 chunk, 1 pointer), or nil for a tag
|
|
233
|
+
# this SDK does not know.
|
|
234
|
+
#
|
|
235
|
+
# @param tag [Integer]
|
|
236
|
+
# @return [String, nil]
|
|
237
|
+
def self.from_tag(tag)
|
|
238
|
+
case tag
|
|
239
|
+
when 0 then CHUNK
|
|
240
|
+
when 1 then POINTER
|
|
241
|
+
end
|
|
242
|
+
end
|
|
243
|
+
end
|
|
244
|
+
|
|
245
|
+
# The write +pointer_prepare+ signs for an external signer.
|
|
246
|
+
module PointerOp
|
|
247
|
+
# Create the pointer at +target+. Refused if it already exists.
|
|
248
|
+
CREATE = "create"
|
|
249
|
+
# Point the pointer at +target+, creating it if it does not exist.
|
|
250
|
+
UPDATE = "update"
|
|
251
|
+
# Hand the pointer over for good to the pointer at +recipient+, which must
|
|
252
|
+
# already exist. Irreversible once stored.
|
|
253
|
+
TRANSFER = "transfer"
|
|
254
|
+
end
|
|
255
|
+
|
|
256
|
+
# Where a pointer stands with respect to finality (+PointerFinality#status+).
|
|
257
|
+
#
|
|
258
|
+
# The status is the daemon's wire string. These are the values this SDK
|
|
259
|
+
# knows; a newer daemon may send another, which is kept verbatim (the
|
|
260
|
+
# "unknown" arm: +PointerFinality#status_known?+ is false). Give a +case+
|
|
261
|
+
# over the status an +else+ branch.
|
|
262
|
+
module PointerFinalityStatus
|
|
263
|
+
# No peer that answered holds a final state: the owner can still move the
|
|
264
|
+
# pointer. Rules a final state out only when every peer answered.
|
|
265
|
+
OPEN = "open"
|
|
266
|
+
# One final state, not yet held by a majority: a transfer still
|
|
267
|
+
# spreading, or a write that fell short.
|
|
268
|
+
SETTLING = "settling"
|
|
269
|
+
# One final state held by a majority, but not every peer answered, so a
|
|
270
|
+
# rival could still be unseen. Ask again.
|
|
271
|
+
UNCONFIRMED = "unconfirmed"
|
|
272
|
+
# One final state held by a majority, every peer answered, no rival. The
|
|
273
|
+
# only status a recipient should rely on.
|
|
274
|
+
FINAL = "final"
|
|
275
|
+
# The owner signed two or more different final states.
|
|
276
|
+
FORKED = "forked"
|
|
277
|
+
|
|
278
|
+
# Every status this SDK knows.
|
|
279
|
+
KNOWN = [OPEN, SETTLING, UNCONFIRMED, FINAL, FORKED].freeze
|
|
280
|
+
|
|
281
|
+
# @param status [String]
|
|
282
|
+
# @return [Boolean] whether this SDK knows +status+
|
|
283
|
+
def self.known?(status)
|
|
284
|
+
KNOWN.include?(status)
|
|
285
|
+
end
|
|
286
|
+
end
|
|
287
|
+
|
|
288
|
+
# The state a pointer write stored (+pointer_create+ / +pointer_update+).
|
|
289
|
+
# +counter+ is an Integer; a final state sits at +POINTER_FINAL_COUNTER+.
|
|
290
|
+
PointerWriteResult = Struct.new(:address, :state_id, :counter, keyword_init: true)
|
|
291
|
+
|
|
292
|
+
# A pointer's current state, as the network serves it (+pointer_get+).
|
|
293
|
+
#
|
|
294
|
+
# - +owner+: the owner's ML-DSA-65 public key (hex, 1,952 bytes). The
|
|
295
|
+
# address is derived from it, so it is the proof of who owns the pointer.
|
|
296
|
+
# - +counter+: Integer, +POINTER_FINAL_COUNTER+ once final.
|
|
297
|
+
# - +kind+: "chunk", "pointer", or "unknown" for a kind the daemon does not
|
|
298
|
+
# know; +kind_tag+ carries the raw value either way.
|
|
299
|
+
# - +is_final+: the state is at the final counter, so nothing can replace it.
|
|
300
|
+
# - +transferred_to+: the pointer this one was handed over to, or nil.
|
|
301
|
+
PointerRecord = Struct.new(
|
|
302
|
+
:address, :owner, :counter, :kind, :kind_tag, :target, :state_id,
|
|
303
|
+
:is_final, :transferred_to,
|
|
304
|
+
keyword_init: true
|
|
305
|
+
) do
|
|
306
|
+
# @return [Boolean] true at the final counter: transferred or frozen
|
|
307
|
+
def final?
|
|
308
|
+
is_final == true
|
|
309
|
+
end
|
|
310
|
+
|
|
311
|
+
# @return [String, nil] the target's +PointerKind+, if this SDK knows its tag
|
|
312
|
+
def target_kind
|
|
313
|
+
PointerKind.from_tag(kind_tag)
|
|
314
|
+
end
|
|
315
|
+
end
|
|
316
|
+
|
|
317
|
+
# Where a chain of pointers ends (+pointer_resolve+): the target's +kind+
|
|
318
|
+
# ("chunk", or "unknown" for a kind the daemon does not know), its raw
|
|
319
|
+
# +kind_tag+ and the +target+ address.
|
|
320
|
+
PointerTarget = Struct.new(:kind, :kind_tag, :target, keyword_init: true) do
|
|
321
|
+
# @return [String, nil] the target's +PointerKind+, if this SDK knows its tag
|
|
322
|
+
def target_kind
|
|
323
|
+
PointerKind.from_tag(kind_tag)
|
|
324
|
+
end
|
|
325
|
+
end
|
|
326
|
+
|
|
327
|
+
# One final state, as a finality check reports it. +holders+ is how many
|
|
328
|
+
# peers of the close group hold it; +transferred_to+ is nil unless the
|
|
329
|
+
# state is a transfer.
|
|
330
|
+
PointerFinalState = Struct.new(
|
|
331
|
+
:state_id, :kind, :kind_tag, :target, :holders, :transferred_to,
|
|
332
|
+
keyword_init: true
|
|
333
|
+
)
|
|
334
|
+
|
|
335
|
+
# Where a pointer stands, as its whole close group reports it
|
|
336
|
+
# (+pointer_finality+). Check it before relying on a transfer: only
|
|
337
|
+
# +final?+ means the transfer is beyond dispute.
|
|
338
|
+
#
|
|
339
|
+
# - +group+ / +answered+: peers in the close group, and peers that answered.
|
|
340
|
+
# - +status+: a +PointerFinalityStatus+ string (see there for unknown ones).
|
|
341
|
+
# - +counter+: +open+ only, the Integer counter a read would return, or nil
|
|
342
|
+
# when no state is corroborated.
|
|
343
|
+
# - +state+: +settling+, +unconfirmed+ and +final+, the one final state seen
|
|
344
|
+
# (+PointerFinalState+), else nil.
|
|
345
|
+
# - +states+ / +majority+: +forked+ only, every final state seen (most-held
|
|
346
|
+
# first) and the one a majority holds, which reads return. +states+ is
|
|
347
|
+
# empty and +majority+ nil otherwise.
|
|
348
|
+
# - +transferred_to+: the pointer this one was handed over to, once that is
|
|
349
|
+
# beyond dispute (status +final+), else nil.
|
|
350
|
+
PointerFinality = Struct.new(
|
|
351
|
+
:address, :group, :answered, :status, :counter, :state, :states,
|
|
352
|
+
:majority, :transferred_to,
|
|
353
|
+
keyword_init: true
|
|
354
|
+
) do
|
|
355
|
+
# @return [Boolean] one final state, held by a majority, every peer
|
|
356
|
+
# answering and no rival seen
|
|
357
|
+
def final?
|
|
358
|
+
status == PointerFinalityStatus::FINAL
|
|
359
|
+
end
|
|
360
|
+
|
|
361
|
+
# @return [Boolean] false for a status a newer daemon added
|
|
362
|
+
def status_known?
|
|
363
|
+
PointerFinalityStatus.known?(status)
|
|
364
|
+
end
|
|
365
|
+
end
|
|
366
|
+
|
|
367
|
+
# Whose pointer decides what an address resolves to, after following every
|
|
368
|
+
# transfer (+pointer_controller+). +transfers+ lists every pointer the
|
|
369
|
+
# address was handed over to, in order; +frozen+ is true when +pointer+ is
|
|
370
|
+
# final without being handed over, so nobody can move it.
|
|
371
|
+
PointerController = Struct.new(:pointer, :transfers, :frozen, keyword_init: true)
|
|
372
|
+
|
|
373
|
+
# What a transfer stored, and where the close group says it stands.
|
|
374
|
+
# +finality+ (a +PointerFinality+) is nil when that check failed, and
|
|
375
|
+
# +finality_error+ says why; the transfer itself is stored and final either
|
|
376
|
+
# way. Ask again with +pointer_finality+.
|
|
377
|
+
PointerTransferResult = Struct.new(:address, :state_id, :finality, :finality_error, keyword_init: true)
|
|
378
|
+
|
|
379
|
+
# A pointer write signed by the daemon and quoted for an external signer
|
|
380
|
+
# (+pointer_prepare+). Pay +payments+ with +payForQuotes()+, then call
|
|
381
|
+
# +pointer_finalize+. +op+ is a +PointerOp+ string, +counter+ an Integer,
|
|
382
|
+
# +payment_type+ always "wave_batch" (a pointer state is paid with one
|
|
383
|
+
# quote). +signed_quotes+ (+SignedQuoteEntry+) is filled only when the
|
|
384
|
+
# prepare asked for it, else empty.
|
|
385
|
+
#
|
|
386
|
+
# While it awaits payment, other writes to the pointer raise
|
|
387
|
+
# +ConflictError+ until it is finalized or expires (one hour).
|
|
388
|
+
PointerPrepareResult = Struct.new(
|
|
389
|
+
:upload_id, :op, :address, :state_id, :counter, :payment_type,
|
|
390
|
+
:payments, :total_amount, :payment_vault_address, :payment_token_address,
|
|
391
|
+
:rpc_url, :signed_quotes,
|
|
392
|
+
keyword_init: true
|
|
393
|
+
)
|
|
394
|
+
|
|
395
|
+
# The state a pointer finalize stored. +finality+ is set for a transfer
|
|
396
|
+
# (where the close group says it stands), else nil.
|
|
397
|
+
PointerFinalizeResult = Struct.new(:address, :state_id, :counter, :finality, keyword_init: true)
|
|
398
|
+
|
|
399
|
+
# Parses a pointer counter. The daemon sends counters as decimal strings on
|
|
400
|
+
# both transports, because a final state sits at 2^64 - 1, past what a JSON
|
|
401
|
+
# number keeps exactly in many languages. Ruby integers are unbounded, so
|
|
402
|
+
# the value is checked against the daemon's u64 range here.
|
|
403
|
+
#
|
|
404
|
+
# Strict: only a String of ASCII digits within u64 parses. +Integer()+ alone
|
|
405
|
+
# would also take a sign, underscores or a radix prefix, and a malformed
|
|
406
|
+
# counter must never read as 0.
|
|
407
|
+
#
|
|
408
|
+
# @param field [String] the field name, for the error message
|
|
409
|
+
# @param value [Object] the wire value
|
|
410
|
+
# @return [Integer]
|
|
411
|
+
# @raise [InternalError] when +value+ is not a decimal u64
|
|
412
|
+
def self.parse_pointer_counter(field, value)
|
|
413
|
+
if value.is_a?(String) && value.match?(/\A[0-9]+\z/)
|
|
414
|
+
n = Integer(value, 10)
|
|
415
|
+
return n if n <= POINTER_FINAL_COUNTER
|
|
416
|
+
end
|
|
417
|
+
raise InternalError, "invalid pointer #{field} #{value.inspect}: expected a decimal u64"
|
|
418
|
+
end
|
|
198
419
|
end
|
data/lib/antd/v1/data_pb.rb
CHANGED
|
@@ -7,7 +7,7 @@ require 'google/protobuf'
|
|
|
7
7
|
require 'antd/v1/common_pb'
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
descriptor_data = "\n\x12\x61ntd/v1/data.proto\x12\x07\x61ntd.v1\x1a\x14\x61ntd/v1/common.proto\"\'\n\x14GetPublicDataRequest\x12\x0f\n\x07\x61\x64\x64ress\x18\x01 \x01(\t\"%\n\x15GetPublicDataResponse\x12\x0c\n\x04\x64\x61ta\x18\x01 \x01(\x0c\":\n\x14PutPublicDataRequest\x12\x0c\n\x04\x64\x61ta\x18\x01 \x01(\x0c\x12\x14\n\x0cpayment_mode\x18\x02 \x01(\t\"w\n\x15PutPublicDataResponse\x12\x1b\n\x04\x63ost\x18\x01 \x01(\x0b\x32\r.antd.v1.Cost\x12\x0f\n\x07\x61\x64\x64ress\x18\x02 \x01(\t\x12\x15\n\rchunks_stored\x18\x03 \x01(\x04\x12\x19\n\x11payment_mode_used\x18\x04 \x01(\t\"
|
|
10
|
+
descriptor_data = "\n\x12\x61ntd/v1/data.proto\x12\x07\x61ntd.v1\x1a\x14\x61ntd/v1/common.proto\"\'\n\x14GetPublicDataRequest\x12\x0f\n\x07\x61\x64\x64ress\x18\x01 \x01(\t\"%\n\x15GetPublicDataResponse\x12\x0c\n\x04\x64\x61ta\x18\x01 \x01(\x0c\":\n\x14PutPublicDataRequest\x12\x0c\n\x04\x64\x61ta\x18\x01 \x01(\x0c\x12\x14\n\x0cpayment_mode\x18\x02 \x01(\t\"w\n\x15PutPublicDataResponse\x12\x1b\n\x04\x63ost\x18\x01 \x01(\x0b\x32\r.antd.v1.Cost\x12\x0f\n\x07\x61\x64\x64ress\x18\x02 \x01(\t\x12\x15\n\rchunks_stored\x18\x03 \x01(\x04\x12\x19\n\x11payment_mode_used\x18\x04 \x01(\t\"\x84\x01\n\x17StreamPublicDataRequest\x12\x0f\n\x07\x61\x64\x64ress\x18\x01 \x01(\t\x12\x18\n\x10include_progress\x18\x02 \x01(\x08\x12\x13\n\x06offset\x18\x03 \x01(\x04H\x00\x88\x01\x01\x12\x13\n\x06length\x18\x04 \x01(\x04H\x01\x88\x01\x01\x42\t\n\x07_offsetB\t\n\x07_length\"R\n\tDataChunk\x12\x0e\n\x04\x64\x61ta\x18\x01 \x01(\x0cH\x00\x12-\n\x08progress\x18\x02 \x01(\x0b\x32\x19.antd.v1.DownloadProgressH\x00\x42\x06\n\x04kind\"A\n\x10\x44ownloadProgress\x12\r\n\x05phase\x18\x01 \x01(\t\x12\x0f\n\x07\x66\x65tched\x18\x02 \x01(\x04\x12\r\n\x05total\x18\x03 \x01(\x04\"\"\n\x0eGetDataRequest\x12\x10\n\x08\x64\x61ta_map\x18\x01 \x01(\t\"\x7f\n\x11StreamDataRequest\x12\x10\n\x08\x64\x61ta_map\x18\x01 \x01(\t\x12\x18\n\x10include_progress\x18\x02 \x01(\x08\x12\x13\n\x06offset\x18\x03 \x01(\x04H\x00\x88\x01\x01\x12\x13\n\x06length\x18\x04 \x01(\x04H\x01\x88\x01\x01\x42\t\n\x07_offsetB\t\n\x07_length\"\x1f\n\x0fGetDataResponse\x12\x0c\n\x04\x64\x61ta\x18\x01 \x01(\x0c\"4\n\x0ePutDataRequest\x12\x0c\n\x04\x64\x61ta\x18\x01 \x01(\x0c\x12\x14\n\x0cpayment_mode\x18\x02 \x01(\t\"r\n\x0fPutDataResponse\x12\x1b\n\x04\x63ost\x18\x01 \x01(\x0b\x32\r.antd.v1.Cost\x12\x10\n\x08\x64\x61ta_map\x18\x02 \x01(\t\x12\x15\n\rchunks_stored\x18\x03 \x01(\x04\x12\x19\n\x11payment_mode_used\x18\x04 \x01(\t\"5\n\x0f\x44\x61taCostRequest\x12\x0c\n\x04\x64\x61ta\x18\x01 \x01(\x0c\x12\x14\n\x0cpayment_mode\x18\x02 \x01(\t2\xce\x03\n\x0b\x44\x61taService\x12\x38\n\x03Put\x12\x17.antd.v1.PutDataRequest\x1a\x18.antd.v1.PutDataResponse\x12J\n\tPutPublic\x12\x1d.antd.v1.PutPublicDataRequest\x1a\x1e.antd.v1.PutPublicDataResponse\x12\x38\n\x03Get\x12\x17.antd.v1.GetDataRequest\x1a\x18.antd.v1.GetDataResponse\x12J\n\tGetPublic\x12\x1d.antd.v1.GetPublicDataRequest\x1a\x1e.antd.v1.GetPublicDataResponse\x12:\n\x06Stream\x12\x1a.antd.v1.StreamDataRequest\x1a\x12.antd.v1.DataChunk0\x01\x12\x46\n\x0cStreamPublic\x12 .antd.v1.StreamPublicDataRequest\x1a\x12.antd.v1.DataChunk0\x01\x12/\n\x04\x43ost\x12\x18.antd.v1.DataCostRequest\x1a\r.antd.v1.CostBDZ8github.com/WithAutonomi/ant-sdk/antd-go/proto/antd/v1;v1\xaa\x02\x07\x41ntd.V1b\x06proto3"
|
|
11
11
|
|
|
12
12
|
pool = ::Google::Protobuf::DescriptorPool.generated_pool
|
|
13
13
|
pool.add_serialized_file(descriptor_data)
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
|
3
|
+
# source: antd/v1/manifests.proto
|
|
4
|
+
|
|
5
|
+
require 'google/protobuf'
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
descriptor_data = "\n\x17\x61ntd/v1/manifests.proto\x12\x07\x61ntd.v1\"}\n\x12ManifestEntryInput\x12\x11\n\x04path\x18\x01 \x01(\tH\x01\x88\x01\x01\x12\x11\n\x04size\x18\x02 \x01(\x04H\x02\x88\x01\x01\x12\x12\n\x08\x64\x61ta_map\x18\x03 \x01(\tH\x00\x12\x11\n\x07\x61\x64\x64ress\x18\x04 \x01(\tH\x00\x42\x08\n\x06sourceB\x07\n\x05_pathB\x07\n\x05_size\"\xa7\x01\n\x14\x42uildManifestRequest\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x1b\n\x13torrent_info_hashes\x18\x02 \x03(\t\x12\x18\n\x0b\x65mbed_roots\x18\x03 \x01(\x08H\x01\x88\x01\x01\x12,\n\x07\x65ntries\x18\x04 \x03(\x0b\x32\x1b.antd.v1.ManifestEntryInputB\x07\n\x05_nameB\x0e\n\x0c_embed_roots\"\xd3\x01\n\x11ManifestEntryInfo\x12\x16\n\x0e\x65\x66\x66\x65\x63tive_name\x18\x01 \x01(\t\x12\x11\n\x04path\x18\x02 \x01(\tH\x00\x88\x01\x01\x12\x11\n\x04size\x18\x03 \x01(\x04H\x01\x88\x01\x01\x12\x0c\n\x04kind\x18\x04 \x01(\t\x12\x17\n\x0f\x63ontent_address\x18\x05 \x01(\t\x12\x10\n\x08\x64\x61ta_map\x18\x06 \x01(\t\x12\x17\n\nexact_size\x18\x07 \x01(\x04H\x02\x88\x01\x01\x12\r\n\x05\x65rror\x18\x08 \x01(\tB\x07\n\x05_pathB\x07\n\x05_sizeB\r\n\x0b_exact_size\"d\n\x15\x42uildManifestResponse\x12\x10\n\x08manifest\x18\x01 \x01(\x0c\x12\x0c\n\x04link\x18\x02 \x01(\t\x12+\n\x07\x65ntries\x18\x03 \x03(\x0b\x32\x1a.antd.v1.ManifestEntryInfo\"U\n\x15\x44\x65\x63odeManifestRequest\x12\x12\n\x08manifest\x18\x01 \x01(\x0cH\x00\x12\x0e\n\x04link\x18\x02 \x01(\tH\x00\x12\x0f\n\x07resolve\x18\x03 \x01(\x08\x42\x07\n\x05input\"\xad\x01\n\x16\x44\x65\x63odeManifestResponse\x12\x0e\n\x06source\x18\x01 \x01(\t\x12\x11\n\x04name\x18\x02 \x01(\tH\x00\x88\x01\x01\x12\x1c\n\x14torrent_info_hash_v1\x18\x03 \x01(\t\x12\x1c\n\x14torrent_info_hash_v2\x18\x04 \x01(\t\x12+\n\x07\x65ntries\x18\x05 \x03(\x0b\x32\x1a.antd.v1.ManifestEntryInfoB\x07\n\x05_name2\xa4\x01\n\x0fManifestService\x12\x46\n\x05\x42uild\x12\x1d.antd.v1.BuildManifestRequest\x1a\x1e.antd.v1.BuildManifestResponse\x12I\n\x06\x44\x65\x63ode\x12\x1e.antd.v1.DecodeManifestRequest\x1a\x1f.antd.v1.DecodeManifestResponseBDZ8github.com/WithAutonomi/ant-sdk/antd-go/proto/antd/v1;v1\xaa\x02\x07\x41ntd.V1b\x06proto3"
|
|
9
|
+
|
|
10
|
+
pool = ::Google::Protobuf::DescriptorPool.generated_pool
|
|
11
|
+
pool.add_serialized_file(descriptor_data)
|
|
12
|
+
|
|
13
|
+
module Antd
|
|
14
|
+
module V1
|
|
15
|
+
ManifestEntryInput = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("antd.v1.ManifestEntryInput").msgclass
|
|
16
|
+
BuildManifestRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("antd.v1.BuildManifestRequest").msgclass
|
|
17
|
+
ManifestEntryInfo = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("antd.v1.ManifestEntryInfo").msgclass
|
|
18
|
+
BuildManifestResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("antd.v1.BuildManifestResponse").msgclass
|
|
19
|
+
DecodeManifestRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("antd.v1.DecodeManifestRequest").msgclass
|
|
20
|
+
DecodeManifestResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("antd.v1.DecodeManifestResponse").msgclass
|
|
21
|
+
end
|
|
22
|
+
end
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
|
2
|
+
# Source: antd/v1/manifests.proto for package 'antd.v1'
|
|
3
|
+
|
|
4
|
+
require 'grpc'
|
|
5
|
+
require 'antd/v1/manifests_pb'
|
|
6
|
+
|
|
7
|
+
module Antd
|
|
8
|
+
module V1
|
|
9
|
+
module ManifestService
|
|
10
|
+
# ADR-0006 file manifests: `.ant` files and `ant://` links (V2-1570).
|
|
11
|
+
#
|
|
12
|
+
# Stateless. The format, content addresses, link encoding and portable path
|
|
13
|
+
# rules all come from ant-core, so callers never re-implement them. The
|
|
14
|
+
# network is touched only to resolve DataMaps: the embedding policy on
|
|
15
|
+
# Build, and `resolve` on Decode.
|
|
16
|
+
#
|
|
17
|
+
# Both calls are unary. A manifest is one document of at most 64 MiB that is
|
|
18
|
+
# produced and parsed whole, so the server accepts requests up to 100 MiB
|
|
19
|
+
# (the REST body limit); clients receiving a large manifest must raise their
|
|
20
|
+
# receive limit (antd-go does this per call).
|
|
21
|
+
class Service
|
|
22
|
+
|
|
23
|
+
include ::GRPC::GenericService
|
|
24
|
+
|
|
25
|
+
self.marshal_class_method = :encode
|
|
26
|
+
self.unmarshal_class_method = :decode
|
|
27
|
+
self.service_name = 'antd.v1.ManifestService'
|
|
28
|
+
|
|
29
|
+
# Build a manifest from DataMaps and public addresses already in hand.
|
|
30
|
+
# Nothing is uploaded or paid for.
|
|
31
|
+
rpc :Build, ::Antd::V1::BuildManifestRequest, ::Antd::V1::BuildManifestResponse
|
|
32
|
+
# Decode `.ant` bytes, a manifest link, a file link or a bare address.
|
|
33
|
+
rpc :Decode, ::Antd::V1::DecodeManifestRequest, ::Antd::V1::DecodeManifestResponse
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
Stub = Service.rpc_stub_class
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
|
3
|
+
# source: antd/v1/pointers.proto
|
|
4
|
+
|
|
5
|
+
require 'google/protobuf'
|
|
6
|
+
|
|
7
|
+
require 'antd/v1/common_pb'
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
descriptor_data = "\n\x16\x61ntd/v1/pointers.proto\x12\x07\x61ntd.v1\x1a\x14\x61ntd/v1/common.proto\"\x18\n\x16ListPointerKeysRequest\"<\n\x17ListPointerKeysResponse\x12!\n\x04keys\x18\x01 \x03(\x0b\x32\x13.antd.v1.PointerKey\"\x1d\n\nPointerKey\x12\x0f\n\x07\x61\x64\x64ress\x18\x01 \x01(\t\"B\n\x13PointerWriteRequest\x12\r\n\x05owner\x18\x01 \x01(\t\x12\x0e\n\x06target\x18\x02 \x01(\t\x12\x0c\n\x04kind\x18\x03 \x01(\t\"J\n\x14PointerWriteResponse\x12\x0f\n\x07\x61\x64\x64ress\x18\x01 \x01(\t\x12\x10\n\x08state_id\x18\x02 \x01(\t\x12\x0f\n\x07\x63ounter\x18\x03 \x01(\t\":\n\x16PointerTransferRequest\x12\r\n\x05owner\x18\x01 \x01(\t\x12\x11\n\trecipient\x18\x02 \x01(\t\"\x80\x01\n\x17PointerTransferResponse\x12\x0f\n\x07\x61\x64\x64ress\x18\x01 \x01(\t\x12\x10\n\x08state_id\x18\x02 \x01(\t\x12*\n\x08\x66inality\x18\x03 \x01(\x0b\x32\x18.antd.v1.PointerFinality\x12\x16\n\x0e\x66inality_error\x18\x04 \x01(\t\"$\n\x11GetPointerRequest\x12\x0f\n\x07\x61\x64\x64ress\x18\x01 \x01(\t\"\xac\x01\n\rPointerRecord\x12\x0f\n\x07\x61\x64\x64ress\x18\x01 \x01(\t\x12\r\n\x05owner\x18\x02 \x01(\t\x12\x0f\n\x07\x63ounter\x18\x03 \x01(\t\x12\x0c\n\x04kind\x18\x04 \x01(\t\x12\x10\n\x08kind_tag\x18\x05 \x01(\r\x12\x0e\n\x06target\x18\x06 \x01(\t\x12\x10\n\x08state_id\x18\x07 \x01(\t\x12\x10\n\x08is_final\x18\x08 \x01(\x08\x12\x16\n\x0etransferred_to\x18\t \x01(\t\"(\n\x15ResolvePointerRequest\x12\x0f\n\x07\x61\x64\x64ress\x18\x01 \x01(\t\"A\n\x0fPointerResolved\x12\x0c\n\x04kind\x18\x01 \x01(\t\x12\x10\n\x08kind_tag\x18\x02 \x01(\r\x12\x0e\n\x06target\x18\x03 \x01(\t\")\n\x16PointerFinalityRequest\x12\x0f\n\x07\x61\x64\x64ress\x18\x01 \x01(\t\"~\n\x11PointerFinalState\x12\x10\n\x08state_id\x18\x01 \x01(\t\x12\x0c\n\x04kind\x18\x02 \x01(\t\x12\x10\n\x08kind_tag\x18\x03 \x01(\r\x12\x0e\n\x06target\x18\x04 \x01(\t\x12\x0f\n\x07holders\x18\x05 \x01(\r\x12\x16\n\x0etransferred_to\x18\x06 \x01(\t\"\x81\x02\n\x0fPointerFinality\x12\x0f\n\x07\x61\x64\x64ress\x18\x01 \x01(\t\x12\r\n\x05group\x18\x02 \x01(\r\x12\x10\n\x08\x61nswered\x18\x03 \x01(\r\x12\x0e\n\x06status\x18\x04 \x01(\t\x12\x0f\n\x07\x63ounter\x18\x05 \x01(\t\x12)\n\x05state\x18\x06 \x01(\x0b\x32\x1a.antd.v1.PointerFinalState\x12*\n\x06states\x18\x07 \x03(\x0b\x32\x1a.antd.v1.PointerFinalState\x12,\n\x08majority\x18\x08 \x01(\x0b\x32\x1a.antd.v1.PointerFinalState\x12\x16\n\x0etransferred_to\x18\t \x01(\t\"+\n\x18PointerControllerRequest\x12\x0f\n\x07\x61\x64\x64ress\x18\x01 \x01(\t\"G\n\x11PointerController\x12\x0f\n\x07pointer\x18\x01 \x01(\t\x12\x11\n\ttransfers\x18\x02 \x03(\t\x12\x0e\n\x06\x66rozen\x18\x03 \x01(\x08\"\x82\x01\n\x15PreparePointerRequest\x12\r\n\x05owner\x18\x01 \x01(\t\x12\n\n\x02op\x18\x02 \x01(\t\x12\x0e\n\x06target\x18\x03 \x01(\t\x12\x0c\n\x04kind\x18\x04 \x01(\t\x12\x11\n\trecipient\x18\x05 \x01(\t\x12\x1d\n\x15include_signed_quotes\x18\x06 \x01(\x08\"\xc1\x02\n\x16PreparePointerResponse\x12\x11\n\tupload_id\x18\x01 \x01(\t\x12\n\n\x02op\x18\x02 \x01(\t\x12\x0f\n\x07\x61\x64\x64ress\x18\x03 \x01(\t\x12\x10\n\x08state_id\x18\x04 \x01(\t\x12\x0f\n\x07\x63ounter\x18\x05 \x01(\t\x12\x14\n\x0cpayment_type\x18\x06 \x01(\t\x12\'\n\x08payments\x18\x07 \x03(\x0b\x32\x15.antd.v1.PaymentEntry\x12\x14\n\x0ctotal_amount\x18\x08 \x01(\t\x12\x1d\n\x15payment_vault_address\x18\t \x01(\t\x12\x1d\n\x15payment_token_address\x18\n \x01(\t\x12\x0f\n\x07rpc_url\x18\x0b \x01(\t\x12\x30\n\rsigned_quotes\x18\x0c \x03(\x0b\x32\x19.antd.v1.SignedQuoteEntry\"\x9e\x01\n\x16\x46inalizePointerRequest\x12\x11\n\tupload_id\x18\x01 \x01(\t\x12@\n\ttx_hashes\x18\x02 \x03(\x0b\x32-.antd.v1.FinalizePointerRequest.TxHashesEntry\x1a/\n\rTxHashesEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\"y\n\x17\x46inalizePointerResponse\x12\x0f\n\x07\x61\x64\x64ress\x18\x01 \x01(\t\x12\x10\n\x08state_id\x18\x02 \x01(\t\x12\x0f\n\x07\x63ounter\x18\x03 \x01(\t\x12*\n\x08\x66inality\x18\x04 \x01(\x0b\x32\x18.antd.v1.PointerFinality2\xeb\x05\n\x0ePointerService\x12M\n\x08ListKeys\x12\x1f.antd.v1.ListPointerKeysRequest\x1a .antd.v1.ListPointerKeysResponse\x12\x45\n\x06\x43reate\x12\x1c.antd.v1.PointerWriteRequest\x1a\x1d.antd.v1.PointerWriteResponse\x12\x45\n\x06Update\x12\x1c.antd.v1.PointerWriteRequest\x1a\x1d.antd.v1.PointerWriteResponse\x12M\n\x08Transfer\x12\x1f.antd.v1.PointerTransferRequest\x1a .antd.v1.PointerTransferResponse\x12\x39\n\x03Get\x12\x1a.antd.v1.GetPointerRequest\x1a\x16.antd.v1.PointerRecord\x12\x43\n\x07Resolve\x12\x1e.antd.v1.ResolvePointerRequest\x1a\x18.antd.v1.PointerResolved\x12\x45\n\x08\x46inality\x12\x1f.antd.v1.PointerFinalityRequest\x1a\x18.antd.v1.PointerFinality\x12K\n\nController\x12!.antd.v1.PointerControllerRequest\x1a\x1a.antd.v1.PointerController\x12J\n\x07Prepare\x12\x1e.antd.v1.PreparePointerRequest\x1a\x1f.antd.v1.PreparePointerResponse\x12M\n\x08\x46inalize\x12\x1f.antd.v1.FinalizePointerRequest\x1a .antd.v1.FinalizePointerResponseBDZ8github.com/WithAutonomi/ant-sdk/antd-go/proto/antd/v1;v1\xaa\x02\x07\x41ntd.V1b\x06proto3"
|
|
11
|
+
|
|
12
|
+
pool = ::Google::Protobuf::DescriptorPool.generated_pool
|
|
13
|
+
pool.add_serialized_file(descriptor_data)
|
|
14
|
+
|
|
15
|
+
module Antd
|
|
16
|
+
module V1
|
|
17
|
+
ListPointerKeysRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("antd.v1.ListPointerKeysRequest").msgclass
|
|
18
|
+
ListPointerKeysResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("antd.v1.ListPointerKeysResponse").msgclass
|
|
19
|
+
PointerKey = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("antd.v1.PointerKey").msgclass
|
|
20
|
+
PointerWriteRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("antd.v1.PointerWriteRequest").msgclass
|
|
21
|
+
PointerWriteResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("antd.v1.PointerWriteResponse").msgclass
|
|
22
|
+
PointerTransferRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("antd.v1.PointerTransferRequest").msgclass
|
|
23
|
+
PointerTransferResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("antd.v1.PointerTransferResponse").msgclass
|
|
24
|
+
GetPointerRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("antd.v1.GetPointerRequest").msgclass
|
|
25
|
+
PointerRecord = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("antd.v1.PointerRecord").msgclass
|
|
26
|
+
ResolvePointerRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("antd.v1.ResolvePointerRequest").msgclass
|
|
27
|
+
PointerResolved = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("antd.v1.PointerResolved").msgclass
|
|
28
|
+
PointerFinalityRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("antd.v1.PointerFinalityRequest").msgclass
|
|
29
|
+
PointerFinalState = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("antd.v1.PointerFinalState").msgclass
|
|
30
|
+
PointerFinality = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("antd.v1.PointerFinality").msgclass
|
|
31
|
+
PointerControllerRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("antd.v1.PointerControllerRequest").msgclass
|
|
32
|
+
PointerController = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("antd.v1.PointerController").msgclass
|
|
33
|
+
PreparePointerRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("antd.v1.PreparePointerRequest").msgclass
|
|
34
|
+
PreparePointerResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("antd.v1.PreparePointerResponse").msgclass
|
|
35
|
+
FinalizePointerRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("antd.v1.FinalizePointerRequest").msgclass
|
|
36
|
+
FinalizePointerResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("antd.v1.FinalizePointerResponse").msgclass
|
|
37
|
+
end
|
|
38
|
+
end
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
|
2
|
+
# Source: antd/v1/pointers.proto for package 'antd.v1'
|
|
3
|
+
|
|
4
|
+
require 'grpc'
|
|
5
|
+
require 'antd/v1/pointers_pb'
|
|
6
|
+
|
|
7
|
+
module Antd
|
|
8
|
+
module V1
|
|
9
|
+
module PointerService
|
|
10
|
+
# Pointers: owner-signed, paid, mutable references (ADR-0016 in ant-node),
|
|
11
|
+
# with ownership transfer by final redirection (ADR-0018). Mirrors the REST
|
|
12
|
+
# `/v1/pointers` surface 1:1.
|
|
13
|
+
#
|
|
14
|
+
# antd signs with owner keys it loaded at startup (`--pointer-keys`). A write
|
|
15
|
+
# names the pointer by its address (`owner`), never by a key; `ListKeys`
|
|
16
|
+
# lists the pointers this daemon can write.
|
|
17
|
+
#
|
|
18
|
+
# Addresses, state ids and targets are 64 hex characters. Counters are
|
|
19
|
+
# decimal strings: a final state sits at u64::MAX.
|
|
20
|
+
#
|
|
21
|
+
# Every write pays, and every attempt pays again. Do not retry Create,
|
|
22
|
+
# Update or Transfer automatically; a Finalize that fails with
|
|
23
|
+
# `CLOSE_GROUP_SHORTFALL` is retried by repeating it with the same
|
|
24
|
+
# `upload_id`, which reuses the payment.
|
|
25
|
+
class Service
|
|
26
|
+
|
|
27
|
+
include ::GRPC::GenericService
|
|
28
|
+
|
|
29
|
+
self.marshal_class_method = :encode
|
|
30
|
+
self.unmarshal_class_method = :decode
|
|
31
|
+
self.service_name = 'antd.v1.PointerService'
|
|
32
|
+
|
|
33
|
+
rpc :ListKeys, ::Antd::V1::ListPointerKeysRequest, ::Antd::V1::ListPointerKeysResponse
|
|
34
|
+
# Create a pointer with the daemon wallet. ALREADY_EXISTS if it exists.
|
|
35
|
+
rpc :Create, ::Antd::V1::PointerWriteRequest, ::Antd::V1::PointerWriteResponse
|
|
36
|
+
# Point a pointer at a new target with the daemon wallet, creating it if
|
|
37
|
+
# it does not exist. FAILED_PRECONDITION if the pointer is final.
|
|
38
|
+
rpc :Update, ::Antd::V1::PointerWriteRequest, ::Antd::V1::PointerWriteResponse
|
|
39
|
+
# Hand a pointer over to the recipient's pointer for good, with the daemon
|
|
40
|
+
# wallet. Irreversible once stored.
|
|
41
|
+
rpc :Transfer, ::Antd::V1::PointerTransferRequest, ::Antd::V1::PointerTransferResponse
|
|
42
|
+
rpc :Get, ::Antd::V1::GetPointerRequest, ::Antd::V1::PointerRecord
|
|
43
|
+
# Follow a chain of pointers to the target at its end.
|
|
44
|
+
rpc :Resolve, ::Antd::V1::ResolvePointerRequest, ::Antd::V1::PointerResolved
|
|
45
|
+
# Ask the whole close group whether a pointer is final, and on what.
|
|
46
|
+
rpc :Finality, ::Antd::V1::PointerFinalityRequest, ::Antd::V1::PointerFinality
|
|
47
|
+
# Follow a pointer's transfers to the pointer whose owner now decides.
|
|
48
|
+
rpc :Controller, ::Antd::V1::PointerControllerRequest, ::Antd::V1::PointerController
|
|
49
|
+
# External signer: sign a write with a loaded key and quote it. Mirrors
|
|
50
|
+
# REST `/v1/pointers/prepare`; the payment shape is ChunkService's.
|
|
51
|
+
rpc :Prepare, ::Antd::V1::PreparePointerRequest, ::Antd::V1::PreparePointerResponse
|
|
52
|
+
# External signer: store the prepared write once it is paid.
|
|
53
|
+
rpc :Finalize, ::Antd::V1::FinalizePointerRequest, ::Antd::V1::FinalizePointerResponse
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
Stub = Service.rpc_stub_class
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
end
|
data/lib/antd/version.rb
CHANGED
data/lib/antd.rb
CHANGED
|
@@ -5,10 +5,12 @@ require_relative "antd/models"
|
|
|
5
5
|
require_relative "antd/errors"
|
|
6
6
|
require_relative "antd/discover"
|
|
7
7
|
require_relative "antd/client"
|
|
8
|
+
require_relative "antd/manifests"
|
|
8
9
|
|
|
9
10
|
# gRPC client is optional — requires the `grpc` gem and proto-generated stubs.
|
|
10
11
|
begin
|
|
11
12
|
require_relative "antd/grpc_client"
|
|
13
|
+
require_relative "antd/grpc_manifests"
|
|
12
14
|
rescue LoadError
|
|
13
15
|
# grpc gem not installed; GrpcClient not available
|
|
14
16
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: antd
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.3.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- WithAutonomi
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-
|
|
11
|
+
date: 2026-10-22 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: grpc
|
|
@@ -97,6 +97,8 @@ files:
|
|
|
97
97
|
- lib/antd/discover.rb
|
|
98
98
|
- lib/antd/errors.rb
|
|
99
99
|
- lib/antd/grpc_client.rb
|
|
100
|
+
- lib/antd/grpc_manifests.rb
|
|
101
|
+
- lib/antd/manifests.rb
|
|
100
102
|
- lib/antd/models.rb
|
|
101
103
|
- lib/antd/v1/chunks_pb.rb
|
|
102
104
|
- lib/antd/v1/chunks_services_pb.rb
|
|
@@ -107,6 +109,10 @@ files:
|
|
|
107
109
|
- lib/antd/v1/files_services_pb.rb
|
|
108
110
|
- lib/antd/v1/health_pb.rb
|
|
109
111
|
- lib/antd/v1/health_services_pb.rb
|
|
112
|
+
- lib/antd/v1/manifests_pb.rb
|
|
113
|
+
- lib/antd/v1/manifests_services_pb.rb
|
|
114
|
+
- lib/antd/v1/pointers_pb.rb
|
|
115
|
+
- lib/antd/v1/pointers_services_pb.rb
|
|
110
116
|
- lib/antd/v1/upload_pb.rb
|
|
111
117
|
- lib/antd/v1/upload_services_pb.rb
|
|
112
118
|
- lib/antd/v1/wallet_pb.rb
|