Commit 27485287 authored by ale's avatar ale
Browse files

Add a metadb HTTP client

parent a0d7f361
package client
import (
type metadbClient struct {
backend clientutil.Backend
func New(config *clientutil.BackendConfig) (tabacco.MetadataStore, error) {
be, err := clientutil.NewBackend(config)
if err != nil {
return nil, err
return &metadbClient{be}, nil
type addDatasetRequest struct {
Backup tabacco.Backup `json:"backup"`
Dataset tabacco.Dataset `json:"dataset"`
func (c *metadbClient) AddDataset(ctx context.Context, backup tabacco.Backup, ds tabacco.Dataset) error {
req := addDatasetRequest{
Backup: backup,
Dataset: ds,
return clientutil.DoJSONHTTPRequest(ctx, c.backend.Client(""), c.backend.URL("")+"/api/add_dataset", &req, nil)
func (c *metadbClient) FindAtoms(ctx context.Context, req tabacco.FindRequest) ([][]tabacco.Version, error) {
var resp [][]tabacco.Version
err := clientutil.DoJSONHTTPRequest(ctx, c.backend.Client(""), c.backend.URL("")+"/api/find_atoms", &req, &resp)
return resp, err
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment