Skip to content

MetaGigachad/hdn-cache-server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Hash delivery network cache server

This server respresents node in between user and data server. It has it's own database of hashes which is updated from data server only on demand.

This project uses tokio as a runtime and sled as it's database to be blazingly fast.

ATTENTION: This server doesn't support standalone mode. It means that data server should be accessable for this server to run.

Configuration

By default server will create configuration file in usual directory for your OS (on *nix it will be $XDG_CONFIG_HOME/hdn-cache-server/default-config.toml). If you wish to use another config you can provide its path through --config parameter. Note that if none such file exists it will be created with default parameters.

Database will also auto create it's files if none exist.

Default config

listener_addr = '127.0.0.1:9002'
data_server_addr = '127.0.0.1:9001'
db_dir = 'data' # Any path can be provided here

Network Deploy

Shortcut: defaults allow you to run one data and one cache server locally without any configuration.

  1. Run data server with appropriate configuration
  2. Configure cache servers with address of data server
  3. Run cache servers with their configuration

Communication with user

Cache server supports two types of requests in form of json's:

Store

Request

{
 "request_type": "store",
 "key": "some_key",
 "hash": "0b672dd94fd3da6a8d404b66ee3f0c83"
}

Response

{
 "response_status": "success"
}

Load

Request

{
 "request_type": "load",
 "key": "some_key"
}

Responses

{
 "response_status": "success",
 "requested_key": "some_key",
 "requested_hash": "0b672dd94fd3da6a8d404b66ee3f0c83",
}
{
 "response_status": "key not found",
}

Communication with data server

Communication with data server uses same types of requests in more optimal scheme and uses postcard format. See crate::messages::data_server for more details.

About

Cache node for hash delivery network

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages