storj/storagenode/vouchers/service.go
Cameron 23587bba0c
Storagenode vouchers table (#2121)
* add vouchers table with methods
2019-06-07 16:20:34 -04:00

23 lines
633 B
Go

// Copyright (C) 2019 Storj Labs, Inc.
// See LICENSE for copying information.
package vouchers
import (
"context"
"time"
"storj.io/storj/pkg/pb"
"storj.io/storj/pkg/storj"
)
// DB implements storing and retrieving vouchers
type DB interface {
// Put inserts or updates a voucher from a satellite
Put(context.Context, *pb.Voucher) error
// GetExpiring retrieves all vouchers that are expired or about to expire
GetExpiring(context.Context, time.Duration) ([]storj.NodeID, error)
// GetValid returns one valid voucher from the list of approved satellites
GetValid(context.Context, []storj.NodeID) (*pb.Voucher, error)
}