Closed pojntfx closed 4 years ago
System information:
pojntfx@Felixs-MBP ~ % neofetch
'c. pojntfx@Felixs-MBP.fritz.box
,xNMM. ----------------------------
.OMMMMo OS: macOS 10.15.3 19D76 x86_64
OMMM0, Host: MacBookPro13,2
.;loddo:' loolloddol;. Kernel: 19.3.0
cKMMMMMMMMMMNWMMMMMMMMMM0: Uptime: 2 days, 22 hours, 14 mins
.KMMMMMMMMMMMMMMMMMMMMMMMWd. Packages: 205 (port), 137 (brew)
XMMMMMMMMMMMMMMMMMMMMMMMX. Shell: zsh 5.7.1
;MMMMMMMMMMMMMMMMMMMMMMMM: Resolution: 1920x1080@2x, 1440x900@2x
:MMMMMMMMMMMMMMMMMMMMMMMM: DE: Aqua
.MMMMMMMMMMMMMMMMMMMMMMMMX. WM: Quartz Compositor
kMMMMMMMMMMMMMMMMMMMMMMMMWd. WM Theme: Blue (Dark)
.XMMMMMMMMMMMMMMMMMMMMMMMMMMk Terminal: Apple_Terminal
.XMMMMMMMMMMMMMMMMMMMMMMMMK. Terminal Font: SFMono-Regular
kMMMMMMMMMMMMMMMMMMMMMMd CPU: Intel i7-6567U (4) @ 3.30GHz
;KMMMMMMMWXXWMMMMMMMk. GPU: Intel Iris Graphics 550
.cooc,. .,coo:. Memory: 10604MiB / 16384MiB
Hi,
First of all: Thanks for this amazing KV store! It is tremendously helpful in building the distributed routing logic for gloeth.
I'm glad to hear that. I hope that Olric would be useful tool for you. Please share your experiences you have.
After a short investigation, I managed to identify the bug. It's caused by strings.TrimLeft
function. Take a look at this:
package main
import (
"fmt"
"strings"
)
func main() {
fmt.Println("strings.TrimLeft for 'get e':", strings.TrimLeft("get e", "get "))
fmt.Println("strings.TrimLeft for 'get b':", strings.TrimLeft("get b", "get "))
}
This small snippet prints the following:
strings.TrimLeft for 'get e':
strings.TrimLeft for 'get b': b
Obviously this is a stupid bug in Golang's stdlib. I'll investigate this. When I replaced strings.TrimLeft
with strings.TrimPrefix
, the problem is gone.
olric-cli
in master should work as expected. Could you please try it?
Note on deploying Olric in embedded-member scenario: memberlist configuration can be painful. I would like to assist you during integration process. You should feel free to open an issue with question tag, if you have questions about integration. There are two important issues on the issue tracker which includes too many information about the integration. Please take a look at:
@buraksezer Thanks for the speedy reply! Can confirm; the issue is no longer present. I'll be sure to take a look at the other memberlist
config-related issues.
@buraksezer you misunderstood how TrimLeft works.
package main
import (
"fmt"
"strings"
)
func main() {
fmt.Println("strings.TrimLeft for 'get g':", strings.TrimLeft("get g", "get "))
fmt.Println("strings.TrimLeft for 'get e':", strings.TrimLeft("get e", "get "))
fmt.Println("strings.TrimLeft for 'get t':", strings.TrimLeft("get t", "get "))
fmt.Println("strings.TrimLeft for 'get b':", strings.TrimLeft("get b", "get "))
}
returns
strings.TrimLeft for 'get g':
strings.TrimLeft for 'get e':
strings.TrimLeft for 'get t':
strings.TrimLeft for 'get b': b
The documentation clearly states:
To remove a prefix, use TrimPrefix instead.
@isavcic Thank you very much for clarification. I realized my fault short after. I had reimplemented olric-cli
tool a few weeks ago. I used strings.Fields
to parse the commands.
First of all: Thanks for this amazing KV store! It is tremendously helpful in building the distributed routing logic for gloeth.
Right now though, it does not seem to be possible to use a key starting with "e":
Thanks for any help!