mirror of
https://github.com/ceph/go-ceph
synced 2024-12-24 23:22:33 +00:00
5f38b5422e
Signed-off-by: Quentin Devos <4972091+Okhoshi@users.noreply.github.com>
27 lines
755 B
Go
27 lines
755 B
Go
package rados
|
|
|
|
import (
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func (suite *RadosTestSuite) TestSetAllocationHint() {
|
|
suite.SetupConnection()
|
|
ta := assert.New(suite.T())
|
|
|
|
oid := "TestSetAllocationHint"
|
|
data := []byte("write this")
|
|
|
|
ioctx, err := suite.conn.OpenIOContext(suite.pool)
|
|
ta.NoError(err)
|
|
err = ioctx.SetAllocationHint(oid, 4096, 20, AllocHintCompressible|AllocHintLonglived|AllocHintRandomRead|AllocHintSequentialWrite)
|
|
ta.NoError(err)
|
|
err = ioctx.WriteFull(oid, []byte(data))
|
|
ta.NoError(err)
|
|
err = ioctx.SetAllocationHint(oid, 128, 128, AllocHintShortlived|AllocHintAppendOnly)
|
|
ta.NoError(err)
|
|
err = ioctx.Append(oid, []byte(data))
|
|
ta.NoError(err)
|
|
err = ioctx.SetAllocationHint(oid, 20, 0, AllocHintNoHint)
|
|
ta.NoError(err)
|
|
}
|