Skip to content

Commit

Permalink
Update protocol to support multiple results and initial payment support
Browse files Browse the repository at this point in the history
  • Loading branch information
riccardobl committed May 23, 2024
1 parent 75b3088 commit 70a7b24
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 1 deletion.
9 changes: 9 additions & 0 deletions proto/Job.proto
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,17 @@ message Job {

repeated string relays = 10;

/**
* Deprecated
*/
JobResult result = 12;

/**
* Deprecated
*/
JobState state = 11;

repeated JobState results = 18;

uint64 maxExecutionTime = 13; // enforced by the provider
string nodeId = 15;
Expand Down
4 changes: 4 additions & 0 deletions proto/JobState.proto
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ syntax = "proto3";

import "Log.proto";
import "JobStatus.proto";
import "JobResult.proto";
option php_namespace = 'App\\Grpc\\nostr';
option php_metadata_namespace = 'App\\Grpc\\nostr\\GPBMetadata';

Expand All @@ -14,4 +15,7 @@ message JobState {
JobStatus status = 15;
repeated Log logs = 17;
uint64 timestamp = 18;

JobResult result = 19;
string acceptedByNode = 20;
}
13 changes: 13 additions & 0 deletions proto/Payment.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@

syntax = "proto3";
option php_namespace = 'App\\Grpc\\nostr';
option php_metadata_namespace = 'App\\Grpc\\nostr\\GPBMetadata';

message Payment {
string id = 1;
uint64 amount = 2;
string currency = 3;
string protocol = 4;
string status = 5;
optional string data = 6;
}
13 changes: 13 additions & 0 deletions proto/PaymentStatus.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@

syntax = "proto3";
option php_namespace = 'App\\Grpc\\nostr';
option php_metadata_namespace = 'App\\Grpc\\nostr\\GPBMetadata';

enum PaymentStatus {
PAYMENT_SENT = 0;
PAYMENT_RECEIVED = 1;
PAYMENT_REFUNDED = 2;
PAYMENT_FAILED = 3;
PAYMENT_PENDING = 4;
PAYMENT_UNKNOWN_STATUS = 99;
}
15 changes: 14 additions & 1 deletion proto/rpc.proto
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ import "JobParam.proto";
import "JobInput.proto";
import "JobResult.proto";
import "Job.proto";
import "Payment.proto";
import "PaymentStatus.proto";

option php_namespace = 'App\\Grpc\\nostr';
option php_metadata_namespace = 'App\\Grpc\\nostr\\GPBMetadata';
message RpcRequestJob {
Expand All @@ -20,12 +23,13 @@ message RpcRequestJob {
optional string requestProvider = 9;
optional bool encrypted = 10;
optional string userId = 11;
optional uint32 minWorkers = 12;
}

message RpcGetJob {
string jobId = 1;
optional uint32 wait = 99; // max time to wait in ms , 0 or unset means no wait

optional uint32 nResultsToWait = 100; // max number of results to wait for
}

message RpcGetPendingJobs {
Expand Down Expand Up @@ -338,6 +342,15 @@ service PoolConnector {
rpc cacheGet(RpcCacheGetRequest) returns (stream RpcCacheGetResponse);


// pay
// rpc requestPayment(RpcRequestPayment) returns (RpcRequestPaymentResponse);
// rpc cancelAndRefundPayment(RpcCancelAndRefundPayment) returns (RpcCancelAndRefundPaymentResponse);

// rpc getPayment(RpcGetPayment) returns (RpcGetPaymentResponse);
// rpc sendPayment(RpcSendPayment) returns (RpcSendPaymentResponse);




}

Expand Down

0 comments on commit 70a7b24

Please sign in to comment.