https://github.com/nickbradley/p2pwiki
Scalable, high-availability peer-to-peer Wikipedia-style encyclopedia
https://github.com/nickbradley/p2pwiki
class-project
Last synced: 9 days ago
JSON representation
Scalable, high-availability peer-to-peer Wikipedia-style encyclopedia
- Host: GitHub
- URL: https://github.com/nickbradley/p2pwiki
- Owner: nickbradley
- Created: 2016-10-23T21:11:51.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2016-12-14T01:35:04.000Z (over 9 years ago)
- Last Synced: 2025-02-25T06:43:39.726Z (over 1 year ago)
- Topics: class-project
- Language: Go
- Homepage:
- Size: 70.3 KB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# P2P Wikipedia
## Installation
To install p2pwiki, clone the repo into your golang working directory and run:
```
> go install github.com/nickbradley/p2pwiki
```
## Usage
### Running the chord server
To start the first node in the chord ring:
```
> p2pwiki 127.0.0.1:2222 server create
```
To join an existing chord ring:
```
> p2pwiki 127.0.0.1:3333 server join 127.0.0.1:2222
```
### Interacting with an article
All article commands have the form
```
p2pwiki article
```
Before viewing/editing an article, it must first be pulled from a peer and stored in the local cache:
```
> p2pwiki 127.0.0.1:3334 article 127.0.0.1:3333 pull A1
Article A1 has been pulled successfully from 127.0.0.1:3333.
```
To view a local article:
```
> p2pwiki 127.0.0.1:3334 article 127.0.0.1:3333 view A1
A1
----
B
```
Local articles can be edited using:
```
> p2pwiki 127.0.0.1:3334 article 127.0.0.1:3333 insert A1 2 "second sentence"
Insert into A1 succeed...
> p2pwiki 127.0.0.1:3334 article 127.0.0.1:3333 view A1
A1
---
B
second sentence
> p2pwiki 127.0.0.1:3334 article 127.0.0.1:3333 delete A1 1
> p2pwiki 127.0.0.1:3334 article 127.0.0.1:3333 view A1
A1
---
second sentence
```
To share your changes you must push your edits to the peer server:
```
> p2pwiki 127.0.0.1:3334 article 127.0.0.1:3333 push A1
Article A1 has sent to 127.0.0.1:3333.
```
Notice that the CRDT will automagically merge changes from multiple pushes.
You can also discard edits by running:
```
> p2pwiki 127.0.0.1:3334 article 127.0.0.1:3333 discard A1
```
## Project structure
```
parent_dir
|-- bin
|-- pkg
|-- src
|-- github.com
|-- nickbradley
|-- p2pwiki
|-- article
|-- article.go
|-- treedoc.go
|-- chord
|-- chord.go
|-- p2pwiki.go
```