Skip to content

Commit

Permalink
feat: support enabling mmap for collection
Browse files Browse the repository at this point in the history
Signed-off-by: yah01 <[email protected]>
  • Loading branch information
yah01 committed Dec 5, 2023
1 parent e47dcc1 commit 3cb6a8e
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions entity/collection_attr.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ const (
cakTTL = `collection.ttl.seconds`
// cakAutoCompaction const for collection attribute key autom compaction enabled.
cakAutoCompaction = `collection.autocompaction.enabled`
akMmap = "mmap.enabled"
)

// CollectionAttribute is the interface for altering collection attributes.
Expand Down Expand Up @@ -89,3 +90,23 @@ func CollectionAutoCompactionEnabled(enabled bool) autoCompactionCollAttr {
ca.value = strconv.FormatBool(enabled)
return ca
}

type mmapAttr struct {
collAttrBase
}

func Mmap(enabled bool) mmapAttr {
attr := mmapAttr{}
attr.key = akMmap
attr.value = strconv.FormatBool(enabled)
return attr
}

func (ca mmapAttr) Valid() error {
_, err := strconv.ParseBool(ca.value)
if err != nil {
return errors.Wrap(err, "mmap setting is not valid boolean")
}

return nil
}

0 comments on commit 3cb6a8e

Please sign in to comment.