This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Shock is a RESTful, high-performance object storage platform for scientific data. It provides file storage with MongoDB-backed metadata, multi-cloud integration (S3, Azure, GCS, IBM TSM), and in-storage operations for bioinformatics data processing.
# Build the server (sets version from git tags)
./compile-server.sh
# Or directly with Go
CGO_ENABLED=0 go install -installsuffix cgo -v -ldflags="-X github.com/MG-RAST/Shock/shock-server/conf.VERSION=$(git describe --tags --long)" ./shock-server/
# Docker build
docker build -t mgrast/shock .shock-server -conf <path_to_config_file>Tests run in Docker with MongoDB:
# Run all tests
./run-tests.sh all
# Run tests for a specific package
./run-tests.sh package ./shock-server/node
# Generate coverage report
./run-tests.sh coverage
# Clean test environment
./run-tests.sh cleanTest utilities are available in shock-server/test/ with mock implementations for database and filesystem.
shock-server/main.go- Server initialization and HTTP routing via chi
| Package | Purpose |
|---|---|
node/ |
Core data model - node CRUD, file management, indexing, ACLs, locations |
file/ |
File handling and format-specific processors (FASTA, SAM, etc.) |
auth/ |
Authentication mechanisms (basic, globus, oauth) |
controller/node/ |
REST API endpoint handlers |
conf/ |
Configuration management (INI + YAML files) |
db/ |
MongoDB connectivity |
location/ |
Storage location management for multi-cloud |
user/ |
User management |
REST API → Controllers → Node Package → MongoDB (metadata) + Filesystem/Cloud (data)
- Main config: INI format (e.g.,
shock-server.conf) - Storage locations:
Locations.yaml - Node types:
Types.yaml
POST/GET/PUT/DELETE /node/{nid}- Node operations/node/{nid}/acl/- Access control/node/{nid}/index/{type}- File indexing/node/{nid}/locations/- Storage locations/preauth/{id}- Pre-authenticated access
- Go 1.22
- MongoDB - Required for metadata storage
- gopkg.in/mgo.v2 - MongoDB driver
- github.com/stretchr/testify - Testing assertions
- AWS, Azure, and GCS SDKs for cloud storage
Built-in pprof available on port 6060 when running.