2019-07-03 16:59:49 +00:00
package config
2019-10-30 16:38:39 +00:00
import (
"encoding"
2021-10-01 08:26:38 +00:00
"os"
"strconv"
2019-10-30 16:38:39 +00:00
"time"
2020-04-03 04:54:07 +00:00
2020-06-18 20:15:18 +00:00
"github.com/ipfs/go-cid"
2021-06-08 13:43:43 +00:00
"github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/go-state-types/big"
2021-05-19 12:32:41 +00:00
miner5 "github.com/filecoin-project/specs-actors/v5/actors/builtin/miner"
2021-07-22 12:37:35 +00:00
"github.com/filecoin-project/lotus/chain/actors/builtin"
"github.com/filecoin-project/lotus/chain/actors/policy"
2020-08-12 17:47:00 +00:00
"github.com/filecoin-project/lotus/chain/types"
2019-10-30 16:38:39 +00:00
)
2019-07-03 16:59:49 +00:00
2021-05-22 17:10:21 +00:00
const (
2021-06-14 04:12:22 +00:00
// RetrievalPricingDefault configures the node to use the default retrieval pricing policy.
2021-06-14 04:40:29 +00:00
RetrievalPricingDefaultMode = "default"
2021-06-14 04:12:22 +00:00
// RetrievalPricingExternal configures the node to use the external retrieval pricing script
2021-05-22 17:10:21 +00:00
// configured by the user.
2021-06-14 04:40:29 +00:00
RetrievalPricingExternalMode = "external"
2021-05-22 17:10:21 +00:00
)
2021-10-01 08:26:38 +00:00
// MaxTraversalLinks configures the maximum number of links to traverse in a DAG while calculating
// CommP and traversing a DAG with graphsync; invokes a budget on DAG depth and density.
var MaxTraversalLinks uint64 = 32 * ( 1 << 20 )
func init ( ) {
if envMaxTraversal , err := strconv . ParseUint ( os . Getenv ( "LOTUS_MAX_TRAVERSAL_LINKS" ) , 10 , 64 ) ; err == nil {
MaxTraversalLinks = envMaxTraversal
}
}
2021-06-08 13:43:43 +00:00
func ( b * BatchFeeConfig ) FeeForSectors ( nSectors int ) abi . TokenAmount {
return big . Add ( big . Int ( b . Base ) , big . Mul ( big . NewInt ( int64 ( nSectors ) ) , big . Int ( b . PerSector ) ) )
}
2019-10-30 16:38:39 +00:00
func defCommon ( ) Common {
return Common {
2019-07-03 16:59:49 +00:00
API : API {
2020-04-03 23:56:52 +00:00
ListenAddress : "/ip4/127.0.0.1/tcp/1234/http" ,
Timeout : Duration ( 30 * time . Second ) ,
2019-07-03 16:59:49 +00:00
} ,
2022-03-10 10:58:31 +00:00
Logging : Logging {
SubsystemLevels : map [ string ] string {
"example-subsystem" : "INFO" ,
} ,
} ,
2022-04-12 21:15:25 +00:00
Backup : Backup {
DisableMetadataLog : true ,
} ,
2019-07-04 12:04:39 +00:00
Libp2p : Libp2p {
ListenAddresses : [ ] string {
2019-07-09 13:46:55 +00:00
"/ip4/0.0.0.0/tcp/0" ,
"/ip6/::/tcp/0" ,
2023-05-10 20:28:09 +00:00
"/ip4/0.0.0.0/udp/0/quic-v1" ,
"/ip6/::/udp/0/quic-v1" ,
"/ip4/0.0.0.0/udp/0/quic-v1/webtransport" ,
"/ip6/::/udp/0/quic-v1/webtransport" ,
2019-07-04 12:04:39 +00:00
} ,
2020-06-09 00:03:11 +00:00
AnnounceAddresses : [ ] string { } ,
NoAnnounceAddresses : [ ] string { } ,
2019-12-17 16:09:43 +00:00
2019-12-18 15:38:58 +00:00
ConnMgrLow : 150 ,
ConnMgrHigh : 180 ,
2019-12-17 16:09:43 +00:00
ConnMgrGrace : Duration ( 20 * time . Second ) ,
2019-07-04 12:04:39 +00:00
} ,
2020-05-04 15:30:54 +00:00
Pubsub : Pubsub {
Bootstrapper : false ,
DirectPeers : nil ,
} ,
2019-07-03 16:59:49 +00:00
}
}
2023-01-13 19:11:13 +00:00
var (
DefaultDefaultMaxFee = types . MustParseFIL ( "0.07" )
DefaultSimultaneousTransfers = uint64 ( 20 )
)
2020-10-29 19:50:04 +00:00
2020-04-03 23:56:52 +00:00
// DefaultFullNode returns the default config
2019-10-30 16:38:39 +00:00
func DefaultFullNode ( ) * FullNode {
return & FullNode {
Common : defCommon ( ) ,
2020-10-29 19:50:04 +00:00
Fees : FeeConfig {
DefaultMaxFee : DefaultDefaultMaxFee ,
} ,
2020-11-24 22:32:30 +00:00
Client : Client {
2021-09-30 01:49:59 +00:00
SimultaneousTransfersForStorage : DefaultSimultaneousTransfers ,
SimultaneousTransfersForRetrieval : DefaultSimultaneousTransfers ,
2020-11-24 22:32:30 +00:00
} ,
2021-03-02 13:45:36 +00:00
Chainstore : Chainstore {
2023-03-09 13:37:34 +00:00
EnableSplitstore : true ,
2021-03-02 13:45:36 +00:00
Splitstore : Splitstore {
2023-03-09 13:37:34 +00:00
ColdStoreType : "discard" ,
2021-06-11 20:22:20 +00:00
HotStoreType : "badger" ,
2022-02-06 09:21:16 +00:00
MarkSetType : "badger" ,
2021-07-23 19:58:34 +00:00
2023-03-09 15:40:14 +00:00
HotStoreFullGCFrequency : 20 ,
2023-04-10 14:13:22 +00:00
HotStoreMaxSpaceTarget : 650_000_000_000 ,
2023-03-09 15:40:14 +00:00
HotStoreMaxSpaceThreshold : 150_000_000_000 ,
HotstoreMaxSpaceSafetyBuffer : 50_000_000_000 ,
2021-03-02 13:45:36 +00:00
} ,
} ,
2022-11-11 20:13:52 +00:00
Cluster : * DefaultUserRaftConfig ( ) ,
2023-01-13 16:49:01 +00:00
Fevm : FevmConfig {
2023-01-19 20:35:19 +00:00
EnableEthRPC : false ,
2023-01-19 17:06:59 +00:00
EthTxHashMappingLifetimeDays : 0 ,
2023-01-20 00:53:21 +00:00
Events : Events {
2023-01-19 22:44:58 +00:00
DisableRealTimeFilterAPI : false ,
DisableHistoricFilterAPI : false ,
FilterTTL : Duration ( time . Hour * 24 ) ,
MaxFilters : 100 ,
MaxFilterResults : 10000 ,
MaxFilterHeightRange : 2880 , // conservative limit of one day
} ,
2023-01-04 13:22:41 +00:00
} ,
2019-10-30 16:38:39 +00:00
}
}
func DefaultStorageMiner ( ) * StorageMiner {
2019-11-12 18:31:17 +00:00
cfg := & StorageMiner {
2019-10-30 16:38:39 +00:00
Common : defCommon ( ) ,
2020-08-18 16:27:28 +00:00
2020-08-18 14:20:31 +00:00
Sealing : SealingConfig {
2020-08-18 17:52:20 +00:00
MaxWaitDealsSectors : 2 , // 64G with 32G sectors
MaxSealingSectors : 0 ,
MaxSealingSectorsForDeals : 0 ,
2020-09-10 18:34:18 +00:00
WaitDealsDelay : Duration ( time . Hour * 6 ) ,
2021-03-08 15:35:46 +00:00
AlwaysKeepUnsealedCopy : true ,
2021-06-11 09:45:20 +00:00
FinalizeEarly : false ,
2022-03-26 19:50:21 +00:00
MakeNewSectorForDeals : true ,
2021-03-10 15:16:44 +00:00
2021-06-29 16:17:08 +00:00
CollateralFromMinerBalance : false ,
2021-07-12 16:46:05 +00:00
AvailableBalanceBuffer : types . FIL ( big . Zero ( ) ) ,
DisableCollateralFallback : false ,
2021-03-10 15:16:44 +00:00
2021-12-08 17:11:19 +00:00
BatchPreCommits : true ,
MaxPreCommitBatch : miner5 . PreCommitSectorBatchMaxSize , // up to 256 sectors
PreCommitBatchWait : Duration ( 24 * time . Hour ) , // this should be less than 31.5 hours, which is the expiration of a precommit ticket
// XXX snap deals wait deals slack if first
PreCommitBatchSlack : Duration ( 3 * time . Hour ) , // time buffer for forceful batch submission before sectors/deals in batch would start expiring, higher value will lower the chances for message fail due to expiration
2021-05-18 14:51:06 +00:00
2021-09-16 01:25:02 +00:00
CommittedCapacitySectorLifetime : Duration ( builtin . EpochDurationSeconds * uint64 ( policy . GetMaxSectorExpirationExtension ( ) ) * uint64 ( time . Second ) ) ,
2021-07-22 12:37:35 +00:00
2021-05-18 14:51:06 +00:00
AggregateCommits : true ,
2021-06-09 22:04:11 +00:00
MinCommitBatch : miner5 . MinAggregatedSectors , // per FIP13, we must have at least four proofs to aggregate, where 4 is the cross over point where aggregation wins out on single provecommit gas costs
MaxCommitBatch : miner5 . MaxAggregatedSectors , // maximum 819 sectors, this is the maximum aggregation per FIP13
CommitBatchWait : Duration ( 24 * time . Hour ) , // this can be up to 30 days
CommitBatchSlack : Duration ( 1 * time . Hour ) , // time buffer for forceful batch submission before sectors/deals in batch would start expiring, higher value will lower the chances for message fail due to expiration
2021-05-18 14:51:06 +00:00
2021-09-30 14:53:12 +00:00
BatchPreCommitAboveBaseFee : types . FIL ( types . BigMul ( types . PicoFil , types . NewInt ( 320 ) ) ) , // 0.32 nFIL
AggregateAboveBaseFee : types . FIL ( types . BigMul ( types . PicoFil , types . NewInt ( 320 ) ) ) , // 0.32 nFIL
2021-07-01 11:33:54 +00:00
2023-04-21 20:35:31 +00:00
TerminateBatchMin : 1 ,
TerminateBatchMax : 100 ,
TerminateBatchWait : Duration ( 5 * time . Minute ) ,
MaxSectorProveCommitsSubmittedPerEpoch : 20 ,
2023-07-12 11:51:50 +00:00
UseSyntheticPoRep : false ,
2020-08-18 14:20:31 +00:00
} ,
2019-11-12 17:59:38 +00:00
2022-03-29 17:22:58 +00:00
Proving : ProvingConfig {
2023-02-28 10:46:11 +00:00
ParallelCheckLimit : 32 ,
2022-11-17 17:25:30 +00:00
PartitionCheckTimeout : Duration ( 20 * time . Minute ) ,
SingleCheckTimeout : Duration ( 10 * time . Minute ) ,
2022-03-29 17:22:58 +00:00
} ,
2022-03-29 01:19:11 +00:00
Storage : SealerConfig {
2022-09-06 09:06:30 +00:00
AllowSectorDownload : true ,
2021-12-08 17:11:19 +00:00
AllowAddPiece : true ,
AllowPreCommit1 : true ,
AllowPreCommit2 : true ,
AllowCommit : true ,
AllowUnseal : true ,
AllowReplicaUpdate : true ,
AllowProveReplicaUpdate2 : true ,
2022-02-14 18:28:49 +00:00
AllowRegenSectorKey : true ,
2020-07-24 15:07:31 +00:00
// Default to 10 - tcp should still be able to figure this out, and
// it's the ratio between 10gbit / 1gbit
ParallelFetchLimit : 10 ,
2021-06-21 19:28:15 +00:00
2022-05-23 14:58:43 +00:00
Assigner : "utilization" ,
2021-06-21 19:28:15 +00:00
// By default use the hardware resource filtering strategy.
2022-10-31 17:15:09 +00:00
ResourceFiltering : ResourceFilteringHardware ,
2020-03-24 19:38:00 +00:00
} ,
2020-06-11 19:15:28 +00:00
Dealmaking : DealmakingConfig {
2020-12-02 06:21:29 +00:00
ConsiderOnlineStorageDeals : true ,
ConsiderOfflineStorageDeals : true ,
ConsiderOnlineRetrievalDeals : true ,
ConsiderOfflineRetrievalDeals : true ,
ConsiderVerifiedStorageDeals : true ,
ConsiderUnverifiedStorageDeals : true ,
PieceCidBlocklist : [ ] cid . Cid { } ,
2020-07-12 17:54:53 +00:00
// TODO: It'd be nice to set this based on sector size
2021-06-23 17:45:08 +00:00
MaxDealStartDelay : Duration ( time . Hour * 24 * 14 ) ,
2021-03-02 09:24:57 +00:00
ExpectedSealDuration : Duration ( time . Hour * 24 ) ,
PublishMsgPeriod : Duration ( time . Hour ) ,
MaxDealsPerPublishMsg : 8 ,
MaxProviderCollateralMultiplier : 2 ,
2021-05-22 17:10:21 +00:00
2021-10-28 11:39:57 +00:00
SimultaneousTransfersForStorage : DefaultSimultaneousTransfers ,
SimultaneousTransfersForStoragePerClient : 0 ,
SimultaneousTransfersForRetrieval : DefaultSimultaneousTransfers ,
2021-06-28 09:39:01 +00:00
2021-09-30 12:35:23 +00:00
StartEpochSealingBuffer : 480 , // 480 epochs buffer == 4 hours from adding deal to sector to sector being sealed
2021-05-22 17:10:21 +00:00
RetrievalPricing : & RetrievalPricing {
2021-06-14 04:40:29 +00:00
Strategy : RetrievalPricingDefaultMode ,
2021-05-22 17:10:21 +00:00
Default : & RetrievalPricingDefault {
VerifiedDealsFreeTransfer : true ,
} ,
2021-06-04 12:03:11 +00:00
External : & RetrievalPricingExternal {
Path : "" ,
} ,
2021-05-22 17:10:21 +00:00
} ,
2020-06-11 19:15:28 +00:00
} ,
2020-07-06 18:39:26 +00:00
2022-02-03 11:51:01 +00:00
IndexProvider : IndexProviderConfig {
2022-03-14 18:56:07 +00:00
Enable : true ,
2022-03-02 13:45:09 +00:00
EntriesCacheCapacity : 1024 ,
EntriesChunkSize : 16384 ,
2022-04-21 11:13:34 +00:00
// The default empty TopicName means it is inferred from network name, in the following
// format: "/indexer/ingest/<network-name>"
TopicName : "" ,
PurgeCacheOnStart : false ,
2021-11-10 16:28:23 +00:00
} ,
2021-05-26 10:47:21 +00:00
Subsystems : MinerSubsystemConfig {
EnableMining : true ,
EnableSealing : true ,
EnableSectorStorage : true ,
2023-05-03 20:42:23 +00:00
EnableMarkets : false ,
2021-05-26 10:47:21 +00:00
} ,
2020-08-12 17:47:00 +00:00
Fees : MinerFeeConfig {
2021-06-08 13:43:43 +00:00
MaxPreCommitGasFee : types . MustParseFIL ( "0.025" ) ,
MaxCommitGasFee : types . MustParseFIL ( "0.05" ) ,
MaxPreCommitBatchGasFee : BatchFeeConfig {
2021-06-22 16:05:14 +00:00
Base : types . MustParseFIL ( "0" ) ,
PerSector : types . MustParseFIL ( "0.02" ) ,
2021-06-08 13:43:43 +00:00
} ,
MaxCommitBatchGasFee : BatchFeeConfig {
2021-06-22 16:05:14 +00:00
Base : types . MustParseFIL ( "0" ) ,
PerSector : types . MustParseFIL ( "0.03" ) , // enough for 6 agg and 1nFIL base fee
2021-06-08 13:43:43 +00:00
} ,
2021-01-12 23:42:01 +00:00
MaxTerminateGasFee : types . MustParseFIL ( "0.5" ) ,
2020-10-15 00:46:47 +00:00
MaxWindowPoStGasFee : types . MustParseFIL ( "5" ) ,
MaxPublishDealsFee : types . MustParseFIL ( "0.05" ) ,
MaxMarketBalanceAddFee : types . MustParseFIL ( "0.007" ) ,
2020-08-12 17:47:00 +00:00
} ,
2020-12-02 20:54:38 +00:00
Addresses : MinerAddressConfig {
2021-07-07 16:00:54 +00:00
PreCommitControl : [ ] string { } ,
CommitControl : [ ] string { } ,
TerminateControl : [ ] string { } ,
DealPublishControl : [ ] string { } ,
2020-12-02 20:54:38 +00:00
} ,
integrate DAG store and CARv2 in deal-making (#6671)
This commit removes badger from the deal-making processes, and
moves to a new architecture with the dagstore as the cental
component on the miner-side, and CARv2s on the client-side.
Every deal that has been handed off to the sealing subsystem becomes
a shard in the dagstore. Shards are mounted via the LotusMount, which
teaches the dagstore how to load the related piece when serving
retrievals.
When the miner starts the Lotus for the first time with this patch,
we will perform a one-time migration of all active deals into the
dagstore. This is a lightweight process, and it consists simply
of registering the shards in the dagstore.
Shards are backed by the unsealed copy of the piece. This is currently
a CARv1. However, the dagstore keeps CARv2 indices for all pieces, so
when it's time to acquire a shard to serve a retrieval, the unsealed
CARv1 is joined with its index (safeguarded by the dagstore), to form
a read-only blockstore, thus taking the place of the monolithic
badger.
Data transfers have been adjusted to interface directly with CARv2 files.
On inbound transfers (client retrievals, miner storage deals), we stream
the received data into a CARv2 ReadWrite blockstore. On outbound transfers
(client storage deals, miner retrievals), we serve the data off a CARv2
ReadOnly blockstore.
Client-side imports are managed by the refactored *imports.Manager
component (when not using IPFS integration). Just like it before, we use
the go-filestore library to avoid duplicating the data from the original
file in the resulting UnixFS DAG (concretely the leaves). However, the
target of those imports are what we call "ref-CARv2s": CARv2 files placed
under the `$LOTUS_PATH/imports` directory, containing the intermediate
nodes in full, and the leaves as positional references to the original file
on disk.
Client-side retrievals are placed into CARv2 files in the location:
`$LOTUS_PATH/retrievals`.
A new set of `Dagstore*` JSON-RPC operations and `lotus-miner dagstore`
subcommands have been introduced on the miner-side to inspect and manage
the dagstore.
Despite moving to a CARv2-backed system, the IPFS integration has been
respected, and it continues to be possible to make storage deals with data
held in an IPFS node, and to perform retrievals directly into an IPFS node.
NOTE: because the "staging" and "client" Badger blockstores are no longer
used, existing imports on the client will be rendered useless. On startup,
Lotus will enumerate all imports and print WARN statements on the log for
each import that needs to be reimported. These log lines contain these
messages:
- import lacks carv2 path; import will not work; please reimport
- import has missing/broken carv2; please reimport
At the end, we will print a "sanity check completed" message indicating
the count of imports found, and how many were deemed broken.
Co-authored-by: Aarsh Shah <aarshkshah1992@gmail.com>
Co-authored-by: Dirk McCormick <dirkmdev@gmail.com>
Co-authored-by: Raúl Kripalani <raul@protocol.ai>
Co-authored-by: Dirk McCormick <dirkmdev@gmail.com>
2021-08-16 22:34:32 +00:00
DAGStore : DAGStoreConfig {
MaxConcurrentIndex : 5 ,
MaxConcurrencyStorageCalls : 100 ,
2022-01-13 18:26:13 +00:00
MaxConcurrentUnseals : 5 ,
integrate DAG store and CARv2 in deal-making (#6671)
This commit removes badger from the deal-making processes, and
moves to a new architecture with the dagstore as the cental
component on the miner-side, and CARv2s on the client-side.
Every deal that has been handed off to the sealing subsystem becomes
a shard in the dagstore. Shards are mounted via the LotusMount, which
teaches the dagstore how to load the related piece when serving
retrievals.
When the miner starts the Lotus for the first time with this patch,
we will perform a one-time migration of all active deals into the
dagstore. This is a lightweight process, and it consists simply
of registering the shards in the dagstore.
Shards are backed by the unsealed copy of the piece. This is currently
a CARv1. However, the dagstore keeps CARv2 indices for all pieces, so
when it's time to acquire a shard to serve a retrieval, the unsealed
CARv1 is joined with its index (safeguarded by the dagstore), to form
a read-only blockstore, thus taking the place of the monolithic
badger.
Data transfers have been adjusted to interface directly with CARv2 files.
On inbound transfers (client retrievals, miner storage deals), we stream
the received data into a CARv2 ReadWrite blockstore. On outbound transfers
(client storage deals, miner retrievals), we serve the data off a CARv2
ReadOnly blockstore.
Client-side imports are managed by the refactored *imports.Manager
component (when not using IPFS integration). Just like it before, we use
the go-filestore library to avoid duplicating the data from the original
file in the resulting UnixFS DAG (concretely the leaves). However, the
target of those imports are what we call "ref-CARv2s": CARv2 files placed
under the `$LOTUS_PATH/imports` directory, containing the intermediate
nodes in full, and the leaves as positional references to the original file
on disk.
Client-side retrievals are placed into CARv2 files in the location:
`$LOTUS_PATH/retrievals`.
A new set of `Dagstore*` JSON-RPC operations and `lotus-miner dagstore`
subcommands have been introduced on the miner-side to inspect and manage
the dagstore.
Despite moving to a CARv2-backed system, the IPFS integration has been
respected, and it continues to be possible to make storage deals with data
held in an IPFS node, and to perform retrievals directly into an IPFS node.
NOTE: because the "staging" and "client" Badger blockstores are no longer
used, existing imports on the client will be rendered useless. On startup,
Lotus will enumerate all imports and print WARN statements on the log for
each import that needs to be reimported. These log lines contain these
messages:
- import lacks carv2 path; import will not work; please reimport
- import has missing/broken carv2; please reimport
At the end, we will print a "sanity check completed" message indicating
the count of imports found, and how many were deemed broken.
Co-authored-by: Aarsh Shah <aarshkshah1992@gmail.com>
Co-authored-by: Dirk McCormick <dirkmdev@gmail.com>
Co-authored-by: Raúl Kripalani <raul@protocol.ai>
Co-authored-by: Dirk McCormick <dirkmdev@gmail.com>
2021-08-16 22:34:32 +00:00
GCInterval : Duration ( 1 * time . Minute ) ,
} ,
2019-10-30 16:38:39 +00:00
}
2021-12-13 14:44:56 +00:00
2019-11-12 21:42:26 +00:00
cfg . Common . API . ListenAddress = "/ip4/127.0.0.1/tcp/2345/http"
2020-04-03 23:56:52 +00:00
cfg . Common . API . RemoteListenAddress = "127.0.0.1:2345"
2019-11-12 18:31:17 +00:00
return cfg
2019-10-30 16:38:39 +00:00
}
2023-01-13 19:11:13 +00:00
var (
_ encoding . TextMarshaler = ( * Duration ) ( nil )
_ encoding . TextUnmarshaler = ( * Duration ) ( nil )
)
2019-10-30 16:38:39 +00:00
// Duration is a wrapper type for time.Duration
// for decoding and encoding from/to TOML
2019-07-03 16:59:49 +00:00
type Duration time . Duration
// UnmarshalText implements interface for TOML decoding
func ( dur * Duration ) UnmarshalText ( text [ ] byte ) error {
d , err := time . ParseDuration ( string ( text ) )
if err != nil {
return err
}
* dur = Duration ( d )
return err
}
2019-10-30 16:38:39 +00:00
func ( dur Duration ) MarshalText ( ) ( [ ] byte , error ) {
d := time . Duration ( dur )
return [ ] byte ( d . String ( ) ) , nil
}
2022-09-13 17:05:48 +00:00
2022-10-31 17:15:09 +00:00
// ResourceFilteringStrategy is an enum indicating the kinds of resource
// filtering strategies that can be configured for workers.
type ResourceFilteringStrategy string
const (
// ResourceFilteringHardware specifies that available hardware resources
// should be evaluated when scheduling a task against the worker.
ResourceFilteringHardware = ResourceFilteringStrategy ( "hardware" )
// ResourceFilteringDisabled disables resource filtering against this
// worker. The scheduler may assign any task to this worker.
ResourceFilteringDisabled = ResourceFilteringStrategy ( "disabled" )
)
2022-11-11 19:41:38 +00:00
2022-09-13 17:05:48 +00:00
var (
DefaultDataSubFolder = "raft"
DefaultWaitForLeaderTimeout = 15 * time . Second
DefaultCommitRetries = 1
DefaultNetworkTimeout = 100 * time . Second
DefaultCommitRetryDelay = 200 * time . Millisecond
DefaultBackupsRotate = 6
)
2022-09-29 10:56:57 +00:00
func DefaultUserRaftConfig ( ) * UserRaftConfig {
var cfg UserRaftConfig
2022-09-13 17:05:48 +00:00
cfg . DataFolder = "" // empty so it gets omitted
2022-09-30 16:45:04 +00:00
cfg . InitPeersetMultiAddr = [ ] string { }
2022-09-21 19:41:10 +00:00
cfg . WaitForLeaderTimeout = Duration ( DefaultWaitForLeaderTimeout )
cfg . NetworkTimeout = Duration ( DefaultNetworkTimeout )
2022-09-13 17:05:48 +00:00
cfg . CommitRetries = DefaultCommitRetries
2022-09-21 19:41:10 +00:00
cfg . CommitRetryDelay = Duration ( DefaultCommitRetryDelay )
2022-09-13 17:05:48 +00:00
cfg . BackupsRotate = DefaultBackupsRotate
return & cfg
}