chore: rename ManagerOption to ClientOption?
Would it make sense to rename ManagerOption to ClientOption and similarly for other Manager related stuff... I am unsure, but connecting it with the "client" side of things would make it easier to understand. I have not thought too deeply about the other names, and if they would clash with other Client names related to multi-service interface names and Configuration objects.
I have been thinking about calling it NodeOptions instead. Each of the ManagerOptions apart from WithLogger are node specific. All methods that create new nodes should accept NodeOptions, or a PerNodeOption function.
addrs := []string{"127.0.0.1:40000", "127.0.0.1:40001", "127.0.0.1:40002", "127.0.0.1:40003"}
m, err := pb.NewManager()
if err != nil {
t.Fatal(err)
}
c1, err := m.NewConfiguration(gorums.WithNodeList(addrs[:2]),
WithSendBufferSize(10)
)
if err != nil {
t.Fatal(err)
}
c2, err := m.NewConfiguration(gorums.WithNodeList(addrs[2:])
gorums.WithPerNodeOptions(func(id uint32) []gorums.NodeOptions {
return []gorums.NodeOptions{gorums.WithSendBufferSize(id%20)}
}
)
if err != nil {
t.Fatal(err)
}
The per node options look ugly but it is more flexible considering metadata is the only per node option that is currently supported.
Somewhat related... Recently, I actually thought about replacing the protobuf per_node_arg Gorums option with a per-call option, the same as in:
Multicast(ctx context.Context, d QuorumCallData, opts ...CallOption)
That way, we can simplify the generated code even more -- there would be no need for a special signature. Just use the main quorum call. I have not prototyped this, but I think it should be possible.
That is, we can add a WithPerNodeArg(func(*Request, uint32) *Request) CallOption that can then be passed as input to a QuorumCall or Multicast call. Not sure about the signature of this CallOption and if there is a better name for it than WithPerNodeArg.
Yes you did mention that, i think calling it Req or Request is better than Arg. Also another call option similar to WithNoSendWaiting could be WithWaitForNSends which waits for a specific amount of nodes, instead of all or nothing.