github.com/lirm/aeron-go@v0.0.0-20230415210743-920325491dc4/cluster/options.go (about)

     1  package cluster
     2  
     3  import (
     4  	"time"
     5  
     6  	"github.com/lirm/aeron-go/aeron/idlestrategy"
     7  	"github.com/lirm/aeron-go/archive"
     8  	"go.uber.org/zap/zapcore"
     9  )
    10  
    11  type Options struct {
    12  	Timeout                 time.Duration      // [runtime] How long to try sending/receiving control messages
    13  	IdleStrategy            idlestrategy.Idler // [runtime] Idlestrategy for sending/receiving control messagesA
    14  	RangeChecking           bool               // [runtime] archive protocol marshalling checks
    15  	Loglevel                zapcore.Level      // [runtime] via logging.SetLevel()
    16  	ClusterDir              string
    17  	ClusterId               int32
    18  	ServiceId               int32
    19  	AppVersion              int32
    20  	ControlChannel          string
    21  	ConsensusModuleStreamId int32
    22  	ServiceStreamId         int32
    23  	SnapshotChannel         string
    24  	SnapshotStreamId        int32
    25  	ReplayChannel           string
    26  	ReplayStreamId          int32
    27  	ArchiveOptions          *archive.Options
    28  	LogFragmentLimit        int
    29  }
    30  
    31  func NewOptions() *Options {
    32  	archiveOpts := archive.DefaultOptions()
    33  	archiveOpts.RequestChannel = "aeron:ipc?alias=cluster-service-archive-ctrl-req|term-length=128k"
    34  	archiveOpts.ResponseChannel = "aeron:ipc?alias=cluster-service-archive-ctrl-resp|term-length=128k"
    35  	return &Options{
    36  		Timeout:                 time.Second * 5,
    37  		IdleStrategy:            idlestrategy.NewDefaultBackoffIdleStrategy(),
    38  		RangeChecking:           true,
    39  		Loglevel:                zapcore.WarnLevel,
    40  		ClusterDir:              "/tmp/aeron-cluster",
    41  		ControlChannel:          "aeron:ipc?term-length=128k|alias=service-control",
    42  		ConsensusModuleStreamId: 105,
    43  		ServiceStreamId:         104,
    44  		SnapshotChannel:         "aeron:ipc?alias=snapshot",
    45  		SnapshotStreamId:        106,
    46  		ReplayChannel:           "aeron:ipc?alias=service-replay",
    47  		ReplayStreamId:          103,
    48  		ArchiveOptions:          archiveOpts,
    49  		LogFragmentLimit:        50,
    50  	}
    51  }