mirror of
https://github.com/fluencelabs/registry.git
synced 2025-04-24 17:52:14 +00:00
feat(registry): Use streams instead of options [LNG-277] (#282)
Use streams instead of options
This commit is contained in:
parent
2259425976
commit
19f5d47add
@ -37,7 +37,7 @@ func appendErrors(error1: *Error, error2: *Error):
|
||||
|
||||
func getResourceHelper(resource_id: ResourceId) -> ?Resource, *Error:
|
||||
nodes <- getNeighbors(resource_id)
|
||||
result: ?Resource
|
||||
result: *Resource
|
||||
error: *Error
|
||||
|
||||
resources: *Key
|
||||
|
@ -15,7 +15,7 @@ func getRecordMetadata(key_id: string, value: string, peer_id: string, relay_id:
|
||||
on INIT_PEER_ID via HOST_PEER_ID:
|
||||
sig_result <- Sig.sign(bytes)
|
||||
|
||||
result: ?RecordMetadata
|
||||
result: *RecordMetadata
|
||||
error: *string
|
||||
if sig_result.success == true:
|
||||
result <- Registry.create_record_metadata(key_id, INIT_PEER_ID, t, value, peer_id, relay_id, service_id, solution, sig_result.signature!)
|
||||
|
@ -24,7 +24,7 @@ func getResourceId(label: string, peer_id: string) -> ResourceId:
|
||||
func createResource(label: string) -> ?ResourceId, *Error:
|
||||
t <- Peer.timestamp_sec()
|
||||
|
||||
resource_id: ?ResourceId
|
||||
resource_id: *ResourceId
|
||||
error: *Error
|
||||
on HOST_PEER_ID:
|
||||
sig_result <- getKeySignature(label, t)
|
||||
@ -57,7 +57,7 @@ func createResource(label: string) -> ?ResourceId, *Error:
|
||||
|
||||
-- Note: resource must be already created
|
||||
func registerService(resource_id: ResourceId, value: string, peer_id: PeerId, service_id: ?string) -> bool, *Error:
|
||||
relay_id: ?string
|
||||
relay_id: *string
|
||||
if peer_id == INIT_PEER_ID:
|
||||
relay_id <<- HOST_PEER_ID
|
||||
|
||||
@ -116,7 +116,7 @@ func registerService(resource_id: ResourceId, value: string, peer_id: PeerId, se
|
||||
|
||||
|
||||
func unregisterService(resource_id: ResourceId, peer_id: PeerId) -> bool, *Error:
|
||||
success: ?bool
|
||||
success: *bool
|
||||
error: *Error
|
||||
|
||||
on HOST_PEER_ID:
|
||||
@ -168,7 +168,7 @@ func unregisterService(resource_id: ResourceId, peer_id: PeerId) -> bool, *Error
|
||||
func resolveResource(resource_id: ResourceId, ack: i16) -> ?[]Record, *Error:
|
||||
on HOST_PEER_ID:
|
||||
nodes <- getNeighbors(resource_id)
|
||||
result: ?[]Record
|
||||
result: *[]Record
|
||||
records: *[]Record
|
||||
error: *Error
|
||||
successful: *bool
|
||||
@ -197,7 +197,7 @@ func resolveResource(resource_id: ResourceId, ack: i16) -> ?[]Record, *Error:
|
||||
-- Execute the given call on providers
|
||||
-- Note that you can provide another Aqua function as an argument to this one
|
||||
func executeOnResource(resource_id: ResourceId, ack: i16, call: Record -> ()) -> bool, *Error:
|
||||
success: ?bool
|
||||
success: *bool
|
||||
result, error <- resolveResource(resource_id, ack)
|
||||
|
||||
if result == nil:
|
||||
|
@ -32,7 +32,7 @@ func registerSubnetworkKey(deal_id: string, peer_id: PeerId, timestamp_created:
|
||||
func createSubnetwork(deal_id: string) -> ?string, *Error:
|
||||
t <- Peer.timestamp_sec()
|
||||
|
||||
subnetwork_id: ?string
|
||||
subnetwork_id: *string
|
||||
error: *Error
|
||||
on HOST_PEER_ID:
|
||||
peer_id <- getInsecuredPeerId()
|
||||
@ -73,7 +73,7 @@ func getWorkerRecordMetadata(subnetwork_id: string) -> ?RecordMetadata, ?string:
|
||||
Sig "sig"
|
||||
sig_result <- Sig.sign(bytes)
|
||||
|
||||
result: ?RecordMetadata
|
||||
result: *RecordMetadata
|
||||
error: *string
|
||||
if sig_result.success == true:
|
||||
result <- Registry.create_record_metadata(subnetwork_id, INIT_PEER_ID, t, "", INIT_PEER_ID, relay_id, nil, nil, sig_result.signature!)
|
||||
@ -148,7 +148,7 @@ func registerWorker(subnetwork_id: string) -> bool, *Error:
|
||||
<- succ, error
|
||||
|
||||
func resolveSubnetwork(deal_id: string) -> ?[]Record, *Error:
|
||||
result: ?[]Record
|
||||
result: *[]Record
|
||||
error: *Error
|
||||
on HOST_PEER_ID:
|
||||
peer_id <- getInsecuredPeerId()
|
||||
|
Loading…
x
Reference in New Issue
Block a user