superfrink / distributed-hash Goto Github PK
View Code? Open in Web Editor NEWA distributed hash table written in Go
A distributed hash table written in Go
Currently the server processes only store data in volatile memory.
Consider:
(echo -n "GET" ; echo -n " a") | nc -q1 localhost 1742
(echo -n "GET" ; sleep 1 ; echo -n " a") | nc -q1 localhost 1742
The former works while the latter does not because the server sees two requests: "GET" followed by " a". Neither of which are valid.
Consider:
(echo 'GET a' ; sleep 1 ; echo 'GET b') | nc -q1 localhost 1742
(echo 'GET a' ; echo 'GET b') | nc -q1 localhost 1742
The former is seen as two GET commands. In the latter case the second GET is discarded in a buffer after the first command is read.
A trailing newline in a GET or PUT request is not trimmed by the server so it becomes part of the key or value. This could either be fixed or become a documented part of the network protocol. I lean towards the former because it feels to be the most likely expected behaviour for someone new to the project.
Consider the following output.
$ echo -n 'PUT a 123' | nc -q1 localhost 1742
cmd: PUT
key: a
val: 123
$ echo 'GET a' | nc -q1 localhost 1742
cmd: GET
key: a
len: 2
NOTEXISTS
$ echo -n 'GET a' | nc -q1 localhost 1742
cmd: GET
key: a
len: 1
EXISTS 3 123
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.