{"action":"created","issue":{"url":"https://api.github.com/repos/livepeer/go-livepeer-basicnet/issues/21","repository_url":"https://api.github.com/repos/livepeer/go-livepeer-basicnet","labels_url":"https://api.github.com/repos/livepeer/go-livepeer-basicnet/issues/21/labels{/name}","comments_url":"https://api.github.com/repos/livepeer/go-livepeer-basicnet/issues/21/comments","events_url":"https://api.github.com/repos/livepeer/go-livepeer-basicnet/issues/21/events","html_url":"https://github.com/livepeer/go-livepeer-basicnet/issues/21","id":300434775,"number":21,"title":"Basicnet Protocol Documentation","user":{"login":"ericxtang","id":345743,"avatar_url":"https://avatars0.githubusercontent.com/u/345743?v=4","gravatar_id":"","url":"https://api.github.com/users/ericxtang","html_url":"https://github.com/ericxtang","followers_url":"https://api.github.com/users/ericxtang/followers","following_url":"https://api.github.com/users/ericxtang/following{/other_user}","gists_url":"https://api.github.com/users/ericxtang/gists{/gist_id}","starred_url":"https://api.github.com/users/ericxtang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ericxtang/subscriptions","organizations_url":"https://api.github.com/users/ericxtang/orgs","repos_url":"https://api.github.com/users/ericxtang/repos","events_url":"https://api.github.com/users/ericxtang/events{/privacy}","received_events_url":"https://api.github.com/users/ericxtang/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":17,"created_at":"2018-02-26T23:21:26Z","updated_at":"2018-03-02T17:27:40Z","closed_at":null,"author_association":"OWNER","body":"## Super Rough Version\r\n\r\n**Message Types:**\r\n\r\n1. Sub\r\n2. Data (video segment)\r\n3. Finish\r\n4. Cancel\r\n5. TranscodeResponse\r\n6. GetMasterPlaylist\r\n7. MasterPlaylistData\r\n8. NodeStatusReq\r\n9. NodeStatusData\r\n\r\n**Node Roles:**\r\n\r\nBroadcaster\r\n* Sends video segments to its listeners\r\n* If no listeners, drop the segments\r\n* Broadcasts exist for each StrmID\r\n\r\nSubscriber\r\n* Receives video segments, and puts it into local video streams\r\n* Subscribers exist for each StrmID\r\n\r\nRelayer\r\n* Receives video segments and calls the callback function.\r\n* Relayers exist for each (MessageType, StrmID)\r\n\r\n\r\n\r\n\r\n**Protocol:**\r\n\r\nWhen a node wants to broadcast a stream:\r\n\r\n* Create a local broadcaster, push Data to the broadcaster's listeners\r\n* This can happen even when no one in the network wants the stream\r\n\r\n\r\nWhen a node wants to subscribe to a stream:\r\n\r\n* Create a local subscriber with the streamID\r\n    * This registers a callback, we usually put the data into a video stream in the caller\r\n* Send Sub req to the network\r\n\r\n\r\nWhen a node receives a Sub req:\r\n\r\n* If there is a local broadcaster, add the requester's ID to its listener array\r\n* If there is a local relayer, add the requester's ID to its listener array\r\n    * We assume the local relayer has already been created and the Sub req has been passed on.\r\n* If there is a local subscriber and no local relayer, create a local relayer, add the requester's ID to its listener array\r\n* If there is no local relayer, local subscriber, or broadcaster, create a local relayer, add the requester's ID to its listener array, and forward the request along.\r\n\r\n\r\nWhen a node receives a Data req:\r\n\r\n* If there is a local subscriber, send the data there\r\n* If there is a local relayer, send the data there\r\n* Otherwise, report an error\r\n\r\n\r\nWhen a broadcaster finishes a stream:\r\n\r\n* Send a Finish message to its listeners\r\n\r\n\r\nWhen a node receives a Finish message:\r\n\r\n* If there is a local subscriber, call it with EOF and delete it\r\n* If there is a local relayer, forward the Cancel message to its listeners, and delete the relayer\r\n\r\n\r\nWhen a node finishes subscribing (for example, player shuts down)\r\n\r\n* Send a Cancel message to its upstream peer and delete the subscriber\r\n\r\n\r\nWhen a node receives a Cancel message:\r\n\r\n* If there is a local broadcaster, remove the peer from its listeners array.\r\n* If there is a local relayer, remove the peer from its listeners array.  If this makes the listeners array empty, remove the relayer.\r\n\r\n\r\nThe node sends a TranscodeResponse msg to the broadcasting node when it gets a transcode job from the blockchain.\r\n\r\n* The broadcasting node should have set up a callback function to be able to receive the TranscodeResponse message (ReceivedTranscodeResponse)\r\n\r\nStrmID might be confusing with MasterPlaylistID → Each master playlist contains multiple media playlists (represented by a single StrmID) - https://developer.apple.com/library/content/referencelibrary/GettingStarted/AboutHTTPLiveStreaming/about/about.html\r\n\r\nThe node populates the masterPlaylist map when it creates a new stream, and updates the masterPlaylist if it receives MasterPlaylistData.\r\n\r\nThe node sends out a GetMasterPlaylist request when it gets a media server video request\r\n\r\nWhen a node receives a GetMasterPlaylist request:\r\n\r\n* If we find the masterPlaylist in the local map, return it.\r\n* If not\r\n    * If the nodeID from the streamID is the current node, we return a NotFound\r\n    * Otherwise, we forward it along, and create a local relayer if it doesn't already exist\r\n\r\nWhen a node receives a MasterPlaylistData\r\n\r\n* If we are the node requesting for it, give it to the requester\r\n* If we are not the node requesting for it, we should have a local relayer, so relay the message along\r\n\r\n\r\nNodeStatus works the same way as GetMasterPlaylist/MasterPlaylistData, it's used for getting a remote node's status (planning to use it for debugging)\r\n"},"comment":{"url":"https://api.github.com/repos/livepeer/go-livepeer-basicnet/issues/comments/369991407","html_url":"https://github.com/livepeer/go-livepeer-basicnet/issues/21#issuecomment-369991407","issue_url":"https://api.github.com/repos/livepeer/go-livepeer-basicnet/issues/21","id":369991407,"user":{"login":"ericxtang","id":345743,"avatar_url":"https://avatars0.githubusercontent.com/u/345743?v=4","gravatar_id":"","url":"https://api.github.com/users/ericxtang","html_url":"https://github.com/ericxtang","followers_url":"https://api.github.com/users/ericxtang/followers","following_url":"https://api.github.com/users/ericxtang/following{/other_user}","gists_url":"https://api.github.com/users/ericxtang/gists{/gist_id}","starred_url":"https://api.github.com/users/ericxtang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ericxtang/subscriptions","organizations_url":"https://api.github.com/users/ericxtang/orgs","repos_url":"https://api.github.com/users/ericxtang/repos","events_url":"https://api.github.com/users/ericxtang/events{/privacy}","received_events_url":"https://api.github.com/users/ericxtang/received_events","type":"User","site_admin":false},"created_at":"2018-03-02T17:27:40Z","updated_at":"2018-03-02T17:27:40Z","author_association":"OWNER","body":"@j0sh I don't have a strong preference between multiaddr and IP/port, just thought it might be more \"generic\" to use IP/port, and have the client decide how to make the connection.\r\n\r\nFor T_NodeID, I have it in there because the libp2p Kademlia network has the ability to query for multiaddr based on NodeID.  I'd like the option just in case we want to switch to it later.\r\n\r\nI think using StreamID instead of B_NodeID is a better idea.  It already contains B_NodeID, and makes the request unique.  Will update the doc.\r\n\r\nThe Transcoder ID is not derivable from the Eth addr, since it's a libp2p/networking concept.  We don't have any of the networking information on chain at the moment, I think we need to think about whether that's a good idea.  But I don't think the Transcoder ID problem holds us back in any way - I see it as an optimization opportunity in the future."}}
{"actor":{"display_login":"ericxtang"}}