MCPcopy Create free account
hub / github.com/ByteStorage/FlyDB / Set

Method Set

lib/datastore/boltdb.go:180–195  ·  view source on GitHub ↗
(key []byte, val []byte)

Source from the content-addressed store, hash-verified

178}
179
180func (ds *BoltDbStore) Set(key []byte, val []byte) error {
181 if len(key) == 0 {
182 return _const.ErrKeyIsEmpty
183 }
184 tx, err := ds.conn.Begin(true) // Start a read-write transaction
185 if err != nil {
186 return err
187 }
188 defer check(tx.Rollback)
189 bucket := tx.Bucket(bucketStable)
190 err = bucket.Put(key, val)
191 if err != nil {
192 return err
193 }
194 return tx.Commit()
195}
196
197func (ds *BoltDbStore) Get(key []byte) ([]byte, error) {
198 if len(key) == 0 {

Callers

nothing calls this directly

Calls 3

checkFunction · 0.85
CommitMethod · 0.80
PutMethod · 0.65

Tested by

no test coverage detected