Skip to content

Commit

Permalink
Add Realtime Video Payment Mechanism
Browse files Browse the repository at this point in the history
It split the payment mechanism from media transport by creating a new endpoint '/payment' dedicated just for payments.
  • Loading branch information
leszko committed Oct 31, 2024
1 parent 7bb0026 commit 4c48a61
Show file tree
Hide file tree
Showing 12 changed files with 787 additions and 368 deletions.
7 changes: 7 additions & 0 deletions core/orchestrator.go
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,13 @@ func (orch *orchestrator) DebitFees(addr ethcommon.Address, manifestID ManifestI
orch.node.Balances.Debit(addr, manifestID, priceRat.Mul(priceRat, big.NewRat(pixels, 1)))
}

func (orch *orchestrator) Balance(addr ethcommon.Address, manifestID ManifestID) *big.Rat {
if orch.node == nil || orch.node.Balances == nil {
return nil
}
return orch.node.Balances.Balance(addr, manifestID)

Check warning on line 411 in core/orchestrator.go

View check run for this annotation

Codecov / codecov/patch

core/orchestrator.go#L407-L411

Added lines #L407 - L411 were not covered by tests
}

func (orch *orchestrator) Capabilities() *net.Capabilities {
if orch.node == nil {
return nil
Expand Down
474 changes: 270 additions & 204 deletions net/lp_rpc.pb.go

Large diffs are not rendered by default.

14 changes: 10 additions & 4 deletions net/lp_rpc.proto
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,10 @@ message Capabilities {
uint32 capacity = 2;
}

map<string, ModelConstraint> models = 1;
map<string, ModelConstraint> models = 1;
}


}

// The orchestrator sends this in response to `GetOrchestrator`, containing
Expand Down Expand Up @@ -338,6 +338,12 @@ message TranscodeResult {
OrchestratorInfo info = 16;
}

// Response that an orchestrator sends after processing a payment.
message PaymentResult {
// Used to notify a broadcaster of updated orchestrator information
OrchestratorInfo info = 16;
}

// Sent by the transcoder to register itself to the orchestrator.
message RegisterRequest {

Expand Down Expand Up @@ -390,7 +396,7 @@ message RegisterAIWorkerRequest {
}

// Data included by the gateway when submitting a AI job.
message AIJobData {
message AIJobData {
// pipeline to use for the job
string pipeline = 1;

Expand All @@ -399,7 +405,7 @@ message AIJobData {
}

// Sent by the orchestrator to the aiworker
message NotifyAIJob {
message NotifyAIJob {
// Configuration for the AI job
AIJobData AIJobData = 1;

Expand Down
Loading

0 comments on commit 4c48a61

Please sign in to comment.