* Add gRPC proxy * Make GRPC disabled by default * WIP on integration tests * WIP on integration tests * Start setting up in process tests * Start setting up in process tests * Make it compile * Add start server to network util * Add Println * Use go routine * Fix scopelint * Move to proxy_test * Add response type cache * Remove proxy * Tweaks * Use channel to handle error * Use error chan * Update server/start.go Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com> * Use %w * Add sdk.Context * Add comments * Fix lint * Add header and tests * Address comments * Factorize some code * Fix lint * Add height and prove in req metadata * Add reflection test * Fix lint * Put grpc test in server/grpc * Update baseapp/grpcserver.go * Update baseapp/grpcserver.go * Remove proof header Co-authored-by: Amaury Martiny <amaury.martiny@protonmail.com> Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com> Co-authored-by: Alexander Bezobchuk <alexanderbez@users.noreply.github.com> Co-authored-by: SaReN <sahithnarahari@gmail.com>
41 lines
1.2 KiB
Go
41 lines
1.2 KiB
Go
package server
|
|
|
|
import (
|
|
"fmt"
|
|
"strings"
|
|
|
|
"github.com/spf13/cast"
|
|
|
|
"github.com/cosmos/cosmos-sdk/server/types"
|
|
"github.com/cosmos/cosmos-sdk/store"
|
|
storetypes "github.com/cosmos/cosmos-sdk/store/types"
|
|
)
|
|
|
|
// GetPruningOptionsFromFlags parses command flags and returns the correct
|
|
// PruningOptions. If a pruning strategy is provided, that will be parsed and
|
|
// returned, otherwise, it is assumed custom pruning options are provided.
|
|
func GetPruningOptionsFromFlags(appOpts types.AppOptions) (storetypes.PruningOptions, error) {
|
|
strategy := strings.ToLower(cast.ToString(appOpts.Get(FlagPruning)))
|
|
|
|
switch strategy {
|
|
case storetypes.PruningOptionDefault, storetypes.PruningOptionNothing, storetypes.PruningOptionEverything:
|
|
return storetypes.NewPruningOptionsFromString(strategy), nil
|
|
|
|
case storetypes.PruningOptionCustom:
|
|
opts := storetypes.NewPruningOptions(
|
|
cast.ToUint64(appOpts.Get(FlagPruningKeepRecent)),
|
|
cast.ToUint64(appOpts.Get(FlagPruningKeepEvery)),
|
|
cast.ToUint64(appOpts.Get(FlagPruningInterval)),
|
|
)
|
|
|
|
if err := opts.Validate(); err != nil {
|
|
return opts, fmt.Errorf("invalid custom pruning options: %w", err)
|
|
}
|
|
|
|
return opts, nil
|
|
|
|
default:
|
|
return store.PruningOptions{}, fmt.Errorf("unknown pruning strategy %s", strategy)
|
|
}
|
|
}
|