Beispiel #1
0
func (v *Volume) bucket(tx *db.Tx) *db.Volume {
	vv, err := tx.Volumes().GetByVolumeID(&v.volID)
	if err != nil {
		log.Printf("volume has disappeared: %v: %v", &v.volID, err)
	}
	return vv
}
Beispiel #2
0
// caller must hold App.volumes.Mutex
func (app *App) openVolume(tx *db.Tx, id *db.VolumeID) (*fs.Volume, error) {
	v, err := tx.Volumes().GetByVolumeID(id)
	if err != nil {
		return nil, err
	}
	kvstore, err := app.OpenKV(tx, v.Storage())
	if err != nil {
		return nil, err
	}

	chunkStore := kvchunks.New(kvstore)
	vol, err := fs.Open(app.DB, chunkStore, id, (*peer.PublicKey)(app.Keys.Sign.Pub))
	if err != nil {
		return nil, err
	}
	return vol, nil
}