Skip to content

Commit

Permalink
Add license and description for files
Browse files Browse the repository at this point in the history
Signed-off-by: Pavel Abramov <[email protected]>
  • Loading branch information
uncleDecart committed Sep 2, 2024
1 parent 9eab304 commit 2d1d298
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
// SPDX-License-Identifier: Apache-2.0

// NkvClient is a structure which is used to
// communicate with Server to get, put, subscribe
// and unsubscribe to a value

pub mod nkv;
pub mod notifier;
mod persist_value;
Expand Down
8 changes: 8 additions & 0 deletions src/nkv.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
// SPDX-License-Identifier: Apache-2.0

// NotifyKeyValue structure is a persistant key-value
// storage with ability to notify clients about changes
// made in a value. When created via new() it will try to
// load values from folder. Underlying structure is a HashMap
// and designed to be access synchronously.

use std::collections::HashMap;
use std::path::PathBuf;

Expand Down
16 changes: 16 additions & 0 deletions src/notifier.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
// SPDX-License-Identifier: Apache-2.0

// Notifier structure is a structure which broadcasts messages
// to all subscribed clients (Subscriber structure). Possible
// messages are following:
//
// - Hello -- is sent when the connection is established between
// Subscriber and Notifier
//
// - Update -- sent new value converted into byte array
//
// - Close -- when the Notifier is closed
//
// - NotFound -- when Subscriber is trying to subscribe to Notifier
// with a value which is not there

extern crate serde;
extern crate serde_json;

Expand Down
6 changes: 6 additions & 0 deletions src/persist_value.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
// SPDX-License-Identifier: Apache-2.0

// PersistValue stores a value of byte arrays
// on a file system. Writing to a disk is an
// atomic operation

use std::fs;
use std::io::Write;
use std::path::{Path, PathBuf};
Expand Down
5 changes: 5 additions & 0 deletions src/request_msg.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
// SPDX-License-Identifier: Apache-2.0

// This file contains common messages which are
// used between NkvClient and Server

use http::StatusCode;
use serde::{Deserialize, Serialize};

Expand Down
7 changes: 7 additions & 0 deletions src/server/srv.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
// SPDX-License-Identifier: Apache-2.0

// Server gives you an asynchronous access to a NotifyKeyValue storage.
// You can get it within the same procees from same or another thread
// using channels or from another program using tcp socket, for message
// format you can check request_msg.rs

use http::StatusCode;
use std::net::SocketAddr;
use std::sync::Arc;
Expand Down

0 comments on commit 2d1d298

Please sign in to comment.