https://github.com/alecthomas/psmap
Persistent static maps for Go
https://github.com/alecthomas/psmap
Last synced: about 1 year ago
JSON representation
Persistent static maps for Go
- Host: GitHub
- URL: https://github.com/alecthomas/psmap
- Owner: alecthomas
- Created: 2013-06-13T03:00:10.000Z (about 13 years ago)
- Default Branch: master
- Last Pushed: 2023-12-02T11:39:09.000Z (over 2 years ago)
- Last Synced: 2025-04-05T18:52:53.760Z (over 1 year ago)
- Language: Go
- Size: 1.95 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Persistent static maps for Go
psmap generates binary files that contain persistent, static maps. It is useful for static data like a Geo IP database, geographical region boundaries, ngram tables, etc.
When opened, the psmap file is mmapped, and an in-memory index constructed. Index RAM overhead is approximately N*36 bytes.
## On-disk structure
In pseudo-Go code, the on disk structure is represented like this:
```go
struct PSM struct {
Data [Size]KeyValue
}
struct KeyValue struct {
KeySize uint32
ValueSize uint32
Key []byte
Value []byte
}
```