add docs to config parameters.

This commit is contained in:
Raúl Kripalani 2021-08-03 23:22:46 +01:00
parent c06c8541f9
commit da28416598
5 changed files with 51 additions and 22 deletions

View File

@ -90,7 +90,7 @@ func NewDAGStore(cfg config.DAGStoreConfig, mountApi MinerAPI) (*dagstore.DAGSto
mountApi: mountApi, mountApi: mountApi,
failureCh: failureCh, failureCh: failureCh,
traceCh: traceCh, traceCh: traceCh,
gcInterval: cfg.GCInterval, gcInterval: time.Duration(cfg.GCIntervalMillis) * time.Millisecond,
} }
return dagst, w, nil return dagst, w, nil

View File

@ -8,9 +8,10 @@ import (
"testing" "testing"
"time" "time"
"github.com/filecoin-project/lotus/node/config"
"golang.org/x/xerrors" "golang.org/x/xerrors"
"github.com/filecoin-project/lotus/node/config"
"github.com/filecoin-project/dagstore" "github.com/filecoin-project/dagstore"
"github.com/filecoin-project/dagstore/mount" "github.com/filecoin-project/dagstore/mount"
"github.com/filecoin-project/dagstore/shard" "github.com/filecoin-project/dagstore/shard"
@ -31,7 +32,7 @@ func TestWrapperAcquireRecovery(t *testing.T) {
TransientsDir: t.TempDir(), TransientsDir: t.TempDir(),
IndexDir: t.TempDir(), IndexDir: t.TempDir(),
DatastoreDir: t.TempDir(), DatastoreDir: t.TempDir(),
GCInterval: time.Millisecond, GCIntervalMillis: 1,
}, mockLotusMount{}) }, mockLotusMount{})
require.NoError(t, err) require.NoError(t, err)
@ -84,7 +85,7 @@ func TestWrapperBackground(t *testing.T) {
TransientsDir: t.TempDir(), TransientsDir: t.TempDir(),
IndexDir: t.TempDir(), IndexDir: t.TempDir(),
DatastoreDir: t.TempDir(), DatastoreDir: t.TempDir(),
GCInterval: time.Millisecond, GCIntervalMillis: 1,
}, mockLotusMount{}) }, mockLotusMount{})
require.NoError(t, err) require.NoError(t, err)

View File

@ -195,7 +195,7 @@ func DefaultStorageMiner() *StorageMiner {
MaxConcurrentIndex: 5, MaxConcurrentIndex: 5,
MaxConcurrentReadyFetches: 2, MaxConcurrentReadyFetches: 2,
MaxConcurrencyStorageCalls: 100, MaxConcurrencyStorageCalls: 100,
GCInterval: time.Minute, GCIntervalMillis: 60000,
}, },
} }
cfg.Common.API.ListenAddress = "/ip4/127.0.0.1/tcp/2345/http" cfg.Common.API.ListenAddress = "/ip4/127.0.0.1/tcp/2345/http"

View File

@ -1,11 +1,10 @@
package config package config
import ( import (
"time" "github.com/ipfs/go-cid"
"github.com/filecoin-project/lotus/chain/types" "github.com/filecoin-project/lotus/chain/types"
sectorstorage "github.com/filecoin-project/lotus/extern/sector-storage" sectorstorage "github.com/filecoin-project/lotus/extern/sector-storage"
"github.com/ipfs/go-cid"
) )
// // NOTE: ONLY PUT STRUCT DEFINITIONS IN THIS FILE // // NOTE: ONLY PUT STRUCT DEFINITIONS IN THIS FILE
@ -55,13 +54,41 @@ type StorageMiner struct {
} }
type DAGStoreConfig struct { type DAGStoreConfig struct {
// Path to the transients directory. The transients directory caches
// unsealed deals that have been fetched from the storage subsystem for
// serving retrievals. When empty or omitted, the default value applies.
// Default value: $LOTUS_MARKETS_PATH/dagStore/transients (split deployment)
// or $LOTUS_MINER_PATH/dagStore/transients (monolith deployment)
TransientsDir string TransientsDir string
// Path to indices directory. When empty or omitted, the default value applies.
// Default value: $LOTUS_MARKETS_PATH/dagStore/index (split deployment)
// or $LOTUS_MINER_PATH/dagStore/index (monolith deployment)
IndexDir string IndexDir string
// Path to datastore directory. The datastore is a KV store tracking the
// state of shards known to the DAG store.
// Default value: $LOTUS_MARKETS_PATH/dagStore/datastore (split deployment)
// or $LOTUS_MINER_PATH/dagStore/datastore (monolith deployment)
DatastoreDir string DatastoreDir string
// The maximum amount of indexing jobs that can run simultaneously.
// Default value: 5.
MaxConcurrentIndex int MaxConcurrentIndex int
// The maximum amount of unsealed deals that can be fetched simultaneously
// from the storage subsystem.
// Default value: 2.
MaxConcurrentReadyFetches int MaxConcurrentReadyFetches int
// The maximum number of simultaneous inflight API calls to the storage
// subsystem.
// Default value: 100.
MaxConcurrencyStorageCalls int MaxConcurrencyStorageCalls int
GCInterval time.Duration
// The number of milliseconds between calls to periodic dagstore GC.
// Default value: 60000 (60 seconds = 1 minute).
GCIntervalMillis int
} }
type MinerSubsystemConfig struct { type MinerSubsystemConfig struct {

View File

@ -9,12 +9,13 @@ import (
"github.com/filecoin-project/dagstore" "github.com/filecoin-project/dagstore"
"github.com/filecoin-project/go-fil-markets/retrievalmarket" "github.com/filecoin-project/go-fil-markets/retrievalmarket"
"go.uber.org/fx"
"golang.org/x/xerrors"
mdagstore "github.com/filecoin-project/lotus/markets/dagstore" mdagstore "github.com/filecoin-project/lotus/markets/dagstore"
"github.com/filecoin-project/lotus/node/config" "github.com/filecoin-project/lotus/node/config"
"github.com/filecoin-project/lotus/node/modules/dtypes" "github.com/filecoin-project/lotus/node/modules/dtypes"
"github.com/filecoin-project/lotus/node/repo" "github.com/filecoin-project/lotus/node/repo"
"go.uber.org/fx"
"golang.org/x/xerrors"
) )
const ( const (
@ -109,7 +110,7 @@ func extractDAGStoreConfig(r repo.LockedRepo) (config.DAGStoreConfig, error) {
if err != nil { if err != nil {
return config.DAGStoreConfig{}, xerrors.Errorf("could not load config: %w", err) return config.DAGStoreConfig{}, xerrors.Errorf("could not load config: %w", err)
} }
mcfg, ok := cfg.(config.StorageMiner) mcfg, ok := cfg.(*config.StorageMiner)
if !ok { if !ok {
return config.DAGStoreConfig{}, xerrors.Errorf("config not expected type; expected config.StorageMiner, got: %T", cfg) return config.DAGStoreConfig{}, xerrors.Errorf("config not expected type; expected config.StorageMiner, got: %T", cfg)
} }