Example #1
0
func (c *Collection) GetOrCreateVolumeLayout(ttl *storage.TTL) *VolumeLayout {
	keyString := ""
	if ttl != nil {
		keyString += ttl.String()
	}
	vl := c.storageType2VolumeLayout.GetOrNew(keyString, func() interface{} {
		return NewVolumeLayout(c.rp, ttl, c.volumeSizeLimit)
	})
	return vl.(*VolumeLayout)
}
Example #2
0
func (c *Collection) GetOrCreateVolumeLayout(rp *storage.ReplicaPlacement, ttl *storage.TTL) *VolumeLayout {
	keyString := rp.String()
	if ttl != nil {
		keyString += ttl.String()
	}
	vl := c.storageType2VolumeLayout.Get(keyString, func() interface{} {
		return NewVolumeLayout(rp, ttl, c.volumeSizeLimit)
	})
	return vl.(*VolumeLayout)
}