Skip to content

Commit

Permalink
db/leveldb: impl index read/write drop encoding/gob (#1370)
Browse files Browse the repository at this point in the history
Two benefit below:
 * shrink go-cqhttp binary size about 200KiB
 * shrink database file from 2.8M to 1.56M compared with v2 database

Also provide a tool to migrate v2 database:
https://github.com/RomiChan/gocq-leveldb-migrate
  • Loading branch information
wdvxdr1123 authored Feb 15, 2022
1 parent f2e26d0 commit 9054d4c
Show file tree
Hide file tree
Showing 7 changed files with 687 additions and 83 deletions.
25 changes: 25 additions & 0 deletions db/leveldb/const.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package leveldb

const dataVersion = 1

const (
group = 0x0
private = 0x1
guildChannel = 0x2
)

type coder byte

const (
coderNil coder = iota
coderInt
coderUint
coderInt32
coderUint32
coderInt64
coderUint64
coderString
coderMSG // global.MSG
coderArrayMSG // []global.MSG
coderStruct // struct{}
)
177 changes: 177 additions & 0 deletions db/leveldb/database_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 9054d4c

Please sign in to comment.