Skip to content

Commit

Permalink
Reapply "feat: support enabling mmap for collection (#632)" (#635) (#661
Browse files Browse the repository at this point in the history
)

This reverts commit 43226a3.

Signed-off-by: yah01 <yang.cen@zilliz.com>
  • Loading branch information
yah01 authored Jan 30, 2024
1 parent 3800770 commit b3abfbe
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 b3abfbe

Please sign in to comment.