piecehub

module
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 10, 2025 License: Apache-2.0

README

piecehub

A high-performance Filecoin piece storage server.

Installation

go install github.com/strahe/piecehub/cmd/piecehub@latest

Quick Start

  1. Simple Directory Mode:
# piecehub dir path1 path2 ...
# Example:

piecehub dir /data/pieces1 /data/pieces2 /data/pieces3
  1. Mutiple Storage Mode:

Create a configuration file config.toml:

[server]
address = ":8080"
read_timeout = 30
write_timeout = 30

[[disks]]
name = "local1"
root_dir = "/data/pieces1"
max_size = 1073741824  # 1GB
direct_io = true

[[disks]]
name = "local2"
root_dir = "/data/pieces2"
max_size = 1073741824  # 1GB
direct_io = true

[[s3s]]
name = "remote1"
endpoint = "https://s3.amazonaws.com"
region = "us-east-1"
bucket = "my-pieces2"
access_key = "xxx"
secret_key = "xxx"

[[s3s]]
name = "remote2"
endpoint = "https://s3.amazonaws.com"
region = "us-east-1"
bucket = "my-pieces2"
access_key = "xxx"
secret_key = "xxx"

Start the server:

piecehub -c config.toml

API

Check Piece Existence
HEAD /pieces?id=<pieceID>

or

GET /pieces?id=<pieceID>
Get Piece Data
GET /data?id=<pieceID>
Download with curl
# Check existence
curl -I http://localhost:8080/pieces?id=xxx

# Download piece
curl -O http://localhost:8080/data?id=xxx

Directories

Path Synopsis
cmd
piecehub command
s3

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL