tradle / multi-hyperbee

A LevelUP compatible leaderless multi-master database with eventual consistency, using hyperbee + CRDT + HLC. Similarly CockroachDB achieves replication on top of RocksDB, but here it is a pure P2P **streaming** database, with zero central management. LevelDB compatibility allows to use Dynalite on top to achieve DynamoDB compatibility with sophisticated auto-updated secondary indexes, and fairly complex queries. Work on Dynalite is almost completed to remove HTTP server, to make this combination perfect for serverless.
36 stars 5 forks source link

The data inserted in one machine has not been transferred to the other machine (example.js) #13

Closed raphael10-collab closed 2 years ago

raphael10-collab commented 2 years ago

I tried to execute example.js using two different machines connected to the same local network.

(laptop):

(base) marco@marco-U36SG:~/hypercore/multi-hyperbee/examples$ node example.js -s laptop
laptop diff key: 7dd426f31c70c623099b08662f53c169f2e70088a297c812e86e88c9c9b194d5

(pc):

(base) raphy@pc:~/hypercore/multi-hyperbee/examples$ node example.js -s pc
pc diff key: abda40768f2be8c75cc4c39aa883add00bf42246cdc370a356051af626aebd61

And on (pc):

(base) raphy@pc:~/hypercore/multi-hyperbee/examples$ node example.js -s laptop,pc -k 7dd426f31c70c623099b08662f53c169f2e70088a297c812e86e88c9c9b194d5,abda40768f2be8c75cc4c39aa883add00bf42246cdc370a356051af626aebd61
laptop,pc diff key: 3c88dffdd37ce961db5e4c08774d18fd26ef8a6bdc6b11100558504fac1bc6ed
Please enter some data
first_data
second_data
third_data
fourth_data

I get on (pc) :

(base) raphy@pc:~/hypercore/multi-hyperbee/examples$ ls -lah
total 44K
drwxrwxr-x  8 raphy raphy 4,0K set 24 17:21 .
drwxrwxr-x 15 raphy raphy 4,0K set 18 12:07 ..
-rw-rw-r--  1 raphy raphy 2,2K set 13 20:00 example.js
drwxrwxr-x  2 raphy raphy 4,0K set 24 17:21 laptop,pc
drwxrwxr-x  2 raphy raphy 4,0K set 24 17:21 laptop,pc_diff
drwxrwxr-x  2 raphy raphy 4,0K set 24 17:21 laptop,pc_peer_1
drwxrwxr-x  2 raphy raphy 4,0K set 24 17:21 laptop,pc_peer_2
-rw-rw-r--  1 raphy raphy  560 set 14 09:24 multi_hyperbee_usage.js
drwxrwxr-x  2 raphy raphy 4,0K set 24 16:54 pc
drwxrwxr-x  2 raphy raphy 4,0K set 24 16:54 pc_diff
-rw-rw-r--  1 raphy raphy  963 set 13 20:00 Readme.md
(base) raphy@pc:~/hypercore/multi-hyperbee/examples$ 

raphy@pc:~/hypercore/multi-hyperbee/examples/laptop,pc_diff$ nano data :

^Hhyperbee^R^U
^Smulti-hyperbee-diff
^E
^C
^A^A^R+laptop,pc_123/2021-09-24T15:21:30.832Z-0000^Z�^A{"_timestamp":"2021-09-24T15:21:30.832Z-0000","obj":{"_objectId":"laptop,pc_123"},"list":{"add":{"firstName":"J","lastName":"S","someField":0>
^F
^D
^B^A^B^R1laptop,pc_firstdata/2021-09-24T15:21:58.566Z-0000^Z}{"_timestamp":"2021-09-24T15:21:58.566Z-0000","obj":{"_objectId":"laptop,pc_firstdata"},"list":{"add":{"text":"first_data"}}}
^G
^E
^C^A^B^C^R2laptop,pc_seconddata/2021-09-24T15:22:01.831Z-0000^Z^?{"_timestamp":"2021-09-24T15:22:01.831Z-0000","obj":{"_objectId":"laptop,pc_seconddata"},"list":{"add":{"text":"second_data"}}}
^H
^F
^D^A^B^C^D^R1laptop,pc_thirddata/2021-09-24T15:22:05.694Z-0000^Z}{"_timestamp":"2021-09-24T15:22:05.694Z-0000","obj":{"_objectId":"laptop,pc_thirddata"},"list":{"add":{"text":"third_data"}}}

~/hypercore/multi-hyperbee/examples/laptop,pc$ nano data :

^Hhyperbee^R
^G__peers
^E
^C
^A^A^R^G__peers^ZD["7dd426f31c70c623099b08662f53c169f2e70088a297c812e86e88c9c9b194d5"]
^E
^C
^A^B^R^G__peers^Z�^A["7dd426f31c70c623099b08662f53c169f2e70088a297c812e86e88c9c9b194d5","abda40768f2be8c75cc4c39aa883add00bf42246cdc370a356051af626aebd61"]
^F
^D
^B^B^C^R^Mlaptop,pc_123^Z�^A{"firstName":"J","lastName":"S","someField":0.6610508317168413,"friends":["Claire","Martha","Jake","Sean"],"_objectId":"laptop,pc_123","_timestamp":"2021-09-24T15:21:30>
^G
^E
^C^B^C^D^R^Slaptop,pc_firstdata^Zd{"text":"first_data","_objectId":"laptop,pc_firstdata","_timestamp":"2021-09-24T15:21:58.566Z-0000"}
^H
^F
^D^B^C^D^E^R^Tlaptop,pc_seconddata^Zf{"text":"second_data","_objectId":"laptop,pc_seconddata","_timestamp":"2021-09-24T15:22:01.831Z-0000"}

^G
^E^B^C^D^E^F^R^Slaptop,pc_thirddata^Zd{"text":"third_data","_objectId":"laptop,pc_thirddata","_timestamp":"2021-09-24T15:22:05.694Z-0000"}

But the data I've inserted in PC has not been transferred to the (laptop):

(base) marco@marco-U36SG:~/hypercore/multi-hyperbee/examples$ ls -lah
total 24K
drwxrwxr-x  4 marco marco 4,0K set 24 16:55 .
drwxrwxr-x 11 marco marco 4,0K set 14 09:43 ..
-rw-rw-r--  1 marco marco 2,2K set 13 21:01 example.js
drwxrwxr-x  2 marco marco 4,0K set 24 16:55 laptop
drwxrwxr-x  2 marco marco 4,0K set 24 16:55 laptop_diff
-rw-rw-r--  1 marco marco  963 set 13 21:01 Readme.md
(base) marco@marco-U36SG:~/hypercore/multi-hyperbee/examples/laptop$ nano data
^Hhyperbee^R
^G__peers

(base) marco@marco-U36SG:~/hypercore/multi-hyperbee/examples/laptop_diff$ nano data
^Hhyperbee^R^U
^Smulti-hyperbee-diff

Is this right, or is there something wrong in my execution and / or environment to fix?