本文整理汇总了Golang中github.com/FoundationDB/fdb-go/fdb/subspace.Subspace.Bytes方法的典型用法代码示例。如果您正苦于以下问题:Golang Subspace.Bytes方法的具体用法?Golang Subspace.Bytes怎么用?Golang Subspace.Bytes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/FoundationDB/fdb-go/fdb/subspace.Subspace
的用法示例。
在下文中一共展示了Subspace.Bytes方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: NewDirectoryLayer
// NewDirectoryLayer returns a new root directory (as a Directory). The
// subspaces nodeSS and contentSS control where the directory metadata and
// contents are stored. The default root directory has a nodeSS of
// subspace.FromBytes([]byte{0xFE}) and a contentSS of
// subspace.AllKeys(). Specifying more restrictive values for nodeSS and
// contentSS will allow using the directory layer alongside other content in a
// database.
//
// If allowManualPrefixes is false, all calls to CreatePrefix on the returned
// Directory (or any subdirectories) will fail, and all directory prefixes will
// be automatically allocated. The default root directory does not allow manual
// prefixes.
func NewDirectoryLayer(nodeSS, contentSS subspace.Subspace, allowManualPrefixes bool) Directory {
var dl directoryLayer
dl.nodeSS = subspace.FromBytes(nodeSS.Bytes())
dl.contentSS = subspace.FromBytes(contentSS.Bytes())
dl.allowManualPrefixes = allowManualPrefixes
dl.rootNode = dl.nodeSS.Sub(dl.nodeSS.Bytes())
dl.allocator = newHCA(dl.rootNode.Sub([]byte("hca")))
return dl
}