dictionary - Store map key/values in a persistent file -
i creating structure more or less of form:
type filestate struct { lastmodified int64 hash string path string }
i want write these values file , read them in on subsequent calls. initial plan read them map , lookup values (hash , lastmodified) using key (path). there slick way of doing in go?
if not, file format can recommend? have read , experimented with key/value file stores in previous projects, not using go. right now, requirements simple big database server system overkill. want can write , read quickly, easily, , portably (windows, mac, linux). because have deploy on multiple platforms trying keep non-go dependencies minimum.
i've considered xml, csv, json. i've briefly looked @ gob package in go , noticed bson package on go package dashboard, i'm not sure if apply.
my primary goal here , running quickly, means least amount of code need write along ease of deployment.
as long entiere data fits in memory, should't have problem. using in-memory map , writing snapshots disk regularly (e.g. using gob
package) idea. practical go programming talk andrew gerrand uses technique.
if need access files different programs, using popular encoding json or csv idea. if have access file within go, use excellent gob package, has a lot of nice features.
as data becomes bigger, it's not idea write whole database disk on every change. also, data might not fit ram anymore. in case, might want take @ leveldb key-value database package nigel tao, go developer. it's under active development (but not yet usable), offer advanced features transactions , automatic compression. also, read/write throughput should quite because of leveldb design.
Comments
Post a Comment