Here's the LSET code:
https://github.com/gitsrc/IceFireDB/blob/main/lists.go#L232
func cmdLSET(m uhaha.Machine, args []string) (interface{}, error) { if len(args) != 4 { return nil, rafthub.ErrWrongNumArgs } index, err := ledis.StrInt64([]byte(args[2]), nil) if err != nil { return nil, err } if err := ldb.LSet([]byte(args[1]), int32(index), []byte(args[3])); err != nil { return nil, err } return redcon.SimpleString("OK"), nil }
1. tidwall/uhaha - Raft server (m uhaha.Machine, rafthub)
2. tidwall/redcon - Read/write redis protocol (redcon.SimpleString)
3. ledisdb/ledisdb - Redis-compatible with disk persistence via leveldb (ldb.LSet)
4. syndtr/goleveldb/leveldb - Provides snapshots, other scattered references throughout code
It also includes this seemingly random file below, which seems to implement some string slice overloads using unsafe.Pointer:
https://github.com/siddontang/go/blob/master/hack/hack.go
// no copy to change slice to string // use your own risk func String(b []byte) (s string) { pbytes := (*reflect.SliceHeader)(unsafe.Pointer(&b)) pstring := (*reflect.StringHeader)(unsafe.Pointer(&s)) pstring.Data = pbytes.Data pstring.Len = pbytes.Len return } // no copy to change string to slice // use your own risk func Slice(s string) (b []byte) { pbytes := (*reflect.SliceHeader)(unsafe.Pointer(&b)) pstring := (*reflect.StringHeader)(unsafe.Pointer(&s)) pbytes.Data = pstring.Data pbytes.Len = pstring.Len pbytes.Cap = pstring.Len return }
Here's the LSET code:
https://github.com/gitsrc/IceFireDB/blob/main/lists.go#L232
So what "IceFireDB" is:1. tidwall/uhaha - Raft server (m uhaha.Machine, rafthub)
2. tidwall/redcon - Read/write redis protocol (redcon.SimpleString)
3. ledisdb/ledisdb - Redis-compatible with disk persistence via leveldb (ldb.LSet)
4. syndtr/goleveldb/leveldb - Provides snapshots, other scattered references throughout code
It also includes this seemingly random file below, which seems to implement some string slice overloads using unsafe.Pointer:
https://github.com/siddontang/go/blob/master/hack/hack.go