Skip to content

filecoin-station/spark-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

spark-api

SPARK API

CI

Routes

POST /retrievals

Start a new retrieval.

Body:

{
  sparkVersion: String,
  zinniaVersion: String
}

Response:

```typescript
{
  id: String,
  cid: String,
  providerAddress: String,
  protocol: 'graphsync'|'bitswap'|'http'
}

PATCH /retrievals/:id

Parameters:

  • id: Request ID (from POST /retrievals)

Body:

{
  participantAddress: String,
  timeout: Boolean,
  startAt: String,       // ISO 8601
  statusCode: Number,
  firstByteAt: String,   // ISO 8601
  endAt: String,         // ISO 8601
  byteLength: Number,
  attestation: String,
  stationId: String
}

Dates should be formatted as ISO 8601 strings.

Response:

OK

Development

Database

Set up PostgreSQL with default settings:

  • Port: 5432
  • User: your system user name
  • Password: blank
  • Database: same as user name

Alternatively, set the environment variable $DATABASE_URL with postgres://${USER}:${PASS}@${HOST}:${POST}/${DATABASE}.

The Postgres user and database need to already exist, and the user needs full management permissions for the database.

You can also the following command to set up the PostgreSQL server via Docker:

docker run -d --name spark-db \
  -e POSTGRES_HOST_AUTH_METHOD=trust \
  -e POSTGRES_USER=$USER \
  -e POSTGRES_DB=$USER \
  -p 5432:5432 \
  postgres

spark-api

Start the API service:

npm start

Run tests and linters:

npm test

Deployment

Pushes to main will be deployed automatically.

Perform manual devops using Fly.io:

$ fly deploy