scylladb / alternator-load-balancing

Various tricks, scripts, and libraries, for load balancing multiple Alternator nodes
Apache License 2.0
18 stars 11 forks source link

Go library doesn't need fake URL - or should document better why it does need it. #1

Open nyh opened 4 years ago

nyh commented 4 years ago

To use the Go library, one uses

alternator_nodes := NewAlternatorNodes("http", 8000, []string {"127.0.0.1"})
sess := alternator_nodes.session("dog.scylladb.com", "alternator", "secret_pass")

But this "dog.scylladb.com" thing is not really needed... It's a left-over from the trick I used in Python where I monkey-patched a global function and had to make that global function still work also for non-fake URLs. In the Go implementation, we have a handler which will only be used for this specific session, so it doesn't care at all what is the URL.

But, that being said, this "dog.scylladb.com" string is currently still used for the "Host:" header. so maybe we still need to provide it! I'm not sure what we can put in the Host: header if we don't supply this string! If we keep this string, we need to document better its purpose.