bgunson / as Goto Github PK
View Code? Open in Web Editor NEWDistributed advertisment system
Home Page: https://adshare.cloud
Distributed advertisment system
Home Page: https://adshare.cloud
Calls to peer handler #uploadAd() results in:
Calls to peer handler #deletaAd() results in:
replication to other peers on upload/delete could be gossip or partial (subset of peers)
Implement a ledger containing peer id and/or handshake address, ad name, etc of those peers who won the ad race. This should be stored in memory or dumped to a .log file on the proxy and synced to connected peers. Connected peers should have the latest copy in the case that a proxy dies, so the connected peers can update the proxy instance with the latest version of the ledger.
Kinks:
diagrams
folder to docs
index.html
from example client to docs folderpeer/main.js
line 29. If length files
is 0, then files[Math.floor(Math.random() * files.length)] == files[0] == undefined
proxy/app.yml
because apparently it is needed for websocket support. See this example from peerjs server and GAE docs here and redeploy.# proxy/app.yml
runtime: nodejs16
env: flex
I think we could achieve some sort of passive and eventual consistency for ad files across peers by using interaction with the system by clients (GET '/ad') to trigger replication.
So, if the ad endpoint is hit, we know multiple connected peers will try to respond. They might have ad files that are mutually exclusive from one another. As it stands we are only setting up a one time event listener within the ad route so slower peers to respond will have their ads thrown out, or potentially buffered on the proxy and served next call to '/ad'.
If we use the giveAd handler to update an observable representing a single ad, we can use the latest incoming ad to be served in the /ad endpoint, as well as intruduce logic within the 'give-ad' handler to emit back to other peers with said ad and it can be uploaded to their disc if they do not already have it.
peer/main.js
line 4 to be domain of deployed proxyas-example-client/index.html
to be domain of deployed proxy (a04502e098a3e52856bdac5edbfe85272a9b36f7)Have the proxy not have to cache the ad file from a peer in the tmp
folder and instead just forward the buffer as a file itself. This should make the proxy's responses faster and reduce the need for disk space on the proxy itself.
the npm package read-last-lines
is handy but when we have an extra newline character at the end of the ledgers, parsing the last line fails and returns an empty string as the assumed latest time stamp
main
, build, tag and publish latest Peer and Proxy Docker images to Docker Hub.
weaken deletion consitency to match the requirements we started in design doc/proposal
We need to track ad ids on a blacklist/whitelist so,
In peer/src/adlist.js
implement:
AdList.add
AdList.remove
Addlist.#update
peer/main.js
.A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.