github.com/asynkron/protoactor-go@v0.0.0-20240308120642-ef91a6abee75/remote/config-opts.go (about) 1 package remote 2 3 import "google.golang.org/grpc" 4 5 type ConfigOption func(config *Config) 6 7 // WithEndpointWriterBatchSize sets the batch size for the endpoint writer 8 func WithEndpointWriterBatchSize(batchSize int) ConfigOption { 9 return func(config *Config) { 10 config.EndpointWriterBatchSize = batchSize 11 } 12 } 13 14 // WithEndpointWriterQueueSize sets the queue size for the endpoint writer 15 func WithEndpointWriterQueueSize(queueSize int) ConfigOption { 16 return func(config *Config) { 17 config.EndpointWriterQueueSize = queueSize 18 } 19 } 20 21 // WithEndpointManagerBatchSize sets the batch size for the endpoint manager 22 func WithEndpointManagerBatchSize(batchSize int) ConfigOption { 23 return func(config *Config) { 24 config.EndpointManagerBatchSize = batchSize 25 } 26 } 27 28 // WithEndpointManagerQueueSize sets the queue size for the endpoint manager 29 func WithEndpointManagerQueueSize(queueSize int) ConfigOption { 30 return func(config *Config) { 31 config.EndpointManagerQueueSize = queueSize 32 } 33 } 34 35 // WithDialOptions sets the dial options for the remote 36 func WithDialOptions(options ...grpc.DialOption) ConfigOption { 37 return func(config *Config) { 38 config.DialOptions = options 39 } 40 } 41 42 // WithServerOptions sets the server options for the remote 43 func WithServerOptions(options ...grpc.ServerOption) ConfigOption { 44 return func(config *Config) { 45 config.ServerOptions = options 46 } 47 } 48 49 // WithCallOptions sets the call options for the remote 50 func WithCallOptions(options ...grpc.CallOption) ConfigOption { 51 return func(config *Config) { 52 config.CallOptions = options 53 } 54 } 55 56 // WithAdvertisedHost sets the advertised host for the remote 57 func WithAdvertisedHost(address string) ConfigOption { 58 return func(config *Config) { 59 config.AdvertisedHost = address 60 } 61 } 62 63 // WithKinds adds the kinds to the remote 64 func WithKinds(kinds ...*Kind) ConfigOption { 65 return func(config *Config) { 66 for _, k := range kinds { 67 config.Kinds[k.Kind] = k.Props 68 } 69 } 70 }