Skip to content
This repository has been archived by the owner on Apr 21, 2022. It is now read-only.

unexport the config #90

Merged
merged 1 commit into from
Nov 26, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions connmgr.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ var log = logging.Logger("connmgr")
type BasicConnMgr struct {
*decayer

cfg *BasicConnManagerConfig
cfg *config
segments segments

plk sync.RWMutex
Expand Down Expand Up @@ -99,7 +99,7 @@ func (s *segment) tagInfoFor(p peer.ID) *peerInfo {
func NewConnManager(low, hi int, grace time.Duration, opts ...Option) *BasicConnMgr {
ctx, cancel := context.WithCancel(context.Background())

cfg := &BasicConnManagerConfig{
cfg := &config{
highWater: hi,
lowWater: low,
gracePeriod: grace,
Expand Down
9 changes: 4 additions & 5 deletions options.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@ package connmgr

import "time"

// BasicConnManagerConfig is the configuration struct for the basic connection
// manager.
type BasicConnManagerConfig struct {
// config is the configuration struct for the basic connection manager.
type config struct {
highWater int
lowWater int
gracePeriod time.Duration
Expand All @@ -13,11 +12,11 @@ type BasicConnManagerConfig struct {
}

// Option represents an option for the basic connection manager.
type Option func(*BasicConnManagerConfig) error
type Option func(*config) error

// DecayerConfig applies a configuration for the decayer.
func DecayerConfig(opts *DecayerCfg) Option {
return func(cfg *BasicConnManagerConfig) error {
return func(cfg *config) error {
cfg.decayer = opts
return nil
}
Expand Down