Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace StreamID with an opaque bigint #31

Open
j0sh opened this issue Mar 15, 2018 · 5 comments
Open

Replace StreamID with an opaque bigint #31

j0sh opened this issue Mar 15, 2018 · 5 comments

Comments

@j0sh
Copy link
Contributor

j0sh commented Mar 15, 2018

For a Livepeer node, this corresponds to the JobID, from which the StreamID can be looked up easily on-chain. Other off-chain applications can use the bigint as a lookup key.

Currently, the only time StreamID is used concretely within basicnet is to determine the broadcaster's NodeID. We should be able to work around this. Treat the ID as an opaque identifier that's used only by the API consumer, not basicnet.

Benefits:

  • The StreamID right now is not a canonical identifier; we need to maintain a reverse lookup table for the JobID to find any transcoder information. This is additional bookkeping that we should avoid.
  • Concretely, solves this issue Basicnet Protocol Documentation #21 (comment)
  • Doesn't make assumptions about the structure of the StreamID within basicnet. This reduces coupling with Livepeer -- other systems might not want to make the same assumptions about their bookkeeping.
  • Further decouples basicnet from Livepeer; keeping this identifier opaque means any changes to the ID in Livepeer doesn't necessitate changes in basicnet.
@yondonfu
Copy link
Member

Reposted from #21

Although I get that using jobIDs in the networking protocol would make certain implementation related tasks easier, it does feel like it is tightly coupling the networking protocol with the smart contract protocol when the networking protocol should be able to be standalone BUT able to integrate with the smart contract protocol if needed. My immediate thought is that by switching from streamIDs to jobIDs in the networking protocol, you lose the ability to request content with JUST a content identifier since the streamID encodes nodeID info that can be used to route to the node serving the content absent other information while the jobID is not able to support this (unless you were thinking of something else besides just using a regular big integer). Additionally I think semantically there should be a difference between "streams" and "jobs" - you should be able to have a stream, but not necessarily have a job.

@j0sh
Copy link
Contributor Author

j0sh commented Mar 15, 2018

you lose the ability to request content with JUST a content identifier since the streamID encodes nodeID info that can be used to route to the node serving the content

Yes, node addressing is something we'll have to fix, but I feel that's an easier problem that would lead to a better architecture overall. We're already making strong assumptions about the structure of StreamID, which IMO increases coupling; it might not be appropriate for all projects using basicnet.

there should be a difference between "streams" and "jobs" - you should be able to have a stream, but not necessarily have a job.

That's the benefit of keeping the identifier opaque -- basicnet doesn't need to know whether the identifier corresponds to a stream, or a job. Could be either, or something else entirely. It's up the the API consumer to interpret that identifier.

@yondonfu
Copy link
Member

yondonfu commented Mar 15, 2018

Yes, node addressing is something we'll have to fix

As long as we're using libp2p peerIDs to route to a node, why not just keep that information in the content identifier so anyone that acquires the content identifier knows exactly how to get it? The ability to always route to the node serving content given a content identifier seems like the right architecture.

We're already making strong assumptions about the structure of StreamID, which IMO increases coupling

Hm I actually don't think the structure of streamID is based on any strong assumptions - its just NodeID|VideoID|Rendition. Given that basicnet is supposed to be a video streaming p2p networking protocol, it seems like the information encoded is reasonable.

basicnet doesn't need to know whether the identifier corresponds to a stream, or a job

I think if basicnet is supposed to be a video streaming p2p networking protocol I think it is reasonable that the native content that is being passed around is assumed to be a video stream since libp2p which basicnet is a layer on top already provides content agnostic messaging such that it does not make any assumptions about the native content being passed around

@j0sh
Copy link
Contributor Author

j0sh commented Mar 15, 2018

The ability to always route to the node serving content given a content identifier seems like the right architecture.

While we should be able to access content given an identifier, that doesn't necessarily mean that identifier should encode a singular source for that content. Consider DHTs, relays, etc.

streamID is based on any strong assumptions - its just NodeID|VideoID|Rendition

We might not even want the NodeID there. First, for the reason stated above. Second, In the current architecture, the StreamID exposes the broadcaster to the p2p network, while the transcoder remains hidden, which is quite the opposite of what we want IMO. I'll go as far to say that is the core of most of our current difficulties with networking. (Will unpack all that in a separate github issue). In any case, the idea of embedding NodeID is something that we should revisit, at least for the broadcaster.

The rendition string, as typically expressed on-chain in the job, doesn't actually tell us anything useful. It's almost always P720p30fps16x9 , which even if accurate, is not actionable (or necessary) information. The use of the rendition string seems to primarily be in 1) providing a somewhat human readable suffix to transcoded stream names, and 2) uniquely identifying streams. Since this discussion is about 2), we can discuss options for 1) elsewhere, but it's not a critical feature.

Another thing here is that the broadcaster only has one StreamID per job. Most (all?) uses of the StreamID in basicnet right now are in terms of the broadcaster's StreamID.

We can still assign transcoded profiles their own ID for selective relaying, etc; the key point being that the ID is opaque to basicnet, so it doesn't have to be aware of the semantics of the ID. That's left up to the API consumer.

So for the sake of argument, supposing we don't need the NodeID or the rendition, that leaves us with Video ID. Which could well be "JobID" or whatever other value the API tells basicnet. Again, basicnet doesn't have to care about the meaning of that value.

I think it is reasonable that the native content that is being passed around is assumed to be a video stream

Basicnet right now is mostly oblivious to the details of content, which is a good thing. IMO its role is in the concrete implementation of a networking protocol for shuffling around that content (video in this case). We can certainly go much deeper into content-awareness later (eg, transcoder capability negotiation) but it's not needed right now.

There's a tension in making protocol implementation as generally useful as possible (eg, for off-chain uses), and minimizing the amount of implementation (eg, invoking specific messages or sequences) that needs to be hoisted up to the protocol consumer.

@yondonfu
Copy link
Member

yondonfu commented Mar 16, 2018 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants