mirror of
https://gitee.com/milvus-io/milvus.git
synced 2025-12-08 18:18:30 +08:00
issue: #33132 pr: #33133 other pr: #33228, #34084, #33946 - implement future-based cgo utility - async search and retrieve in cgo - modify gc configuration document --------- Signed-off-by: chyezh <chyezh@outlook.com>
33 lines
591 B
Go
33 lines
591 B
Go
package cgo
|
|
|
|
func getDefaultOpt() *options {
|
|
return &options{
|
|
name: "unknown",
|
|
releaser: nil,
|
|
}
|
|
}
|
|
|
|
type options struct {
|
|
name string
|
|
releaser func()
|
|
}
|
|
|
|
// Opt is the option type for future.
|
|
type Opt func(*options)
|
|
|
|
// WithReleaser sets the releaser function.
|
|
// When a future is ready, the releaser function will be called once.
|
|
func WithReleaser(releaser func()) Opt {
|
|
return func(o *options) {
|
|
o.releaser = releaser
|
|
}
|
|
}
|
|
|
|
// WithName sets the name of the future.
|
|
// Only used for metrics.
|
|
func WithName(name string) Opt {
|
|
return func(o *options) {
|
|
o.name = name
|
|
}
|
|
}
|