mirror of
https://github.com/safing/portbase
synced 2025-09-04 03:29:59 +00:00
Update documentation in runtime package regarding PushFunc
This commit is contained in:
parent
4756896d32
commit
a3bceeabcf
2 changed files with 4 additions and 2 deletions
|
@ -18,7 +18,9 @@ var (
|
||||||
type (
|
type (
|
||||||
// PushFunc is returned when registering a new value provider
|
// PushFunc is returned when registering a new value provider
|
||||||
// and can be used to inform the database system about the
|
// and can be used to inform the database system about the
|
||||||
// availability of a new runtime record value.
|
// availability of a new runtime record value. Similar to
|
||||||
|
// database.Controller.PushUpdate, the caller must hold
|
||||||
|
// the lock for each record passed to PushFunc.
|
||||||
PushFunc func(...record.Record)
|
PushFunc func(...record.Record)
|
||||||
|
|
||||||
// ValueProvider provides access to a runtime-computed
|
// ValueProvider provides access to a runtime-computed
|
||||||
|
|
|
@ -23,8 +23,8 @@ type singleRecordReader struct {
|
||||||
// pushUpdate, _ := runtime.Register("my/key", ProvideRecord(r))
|
// pushUpdate, _ := runtime.Register("my/key", ProvideRecord(r))
|
||||||
// r.Lock()
|
// r.Lock()
|
||||||
// r.Value = "foobar"
|
// r.Value = "foobar"
|
||||||
// r.Unlock()
|
|
||||||
// pushUpdate(r)
|
// pushUpdate(r)
|
||||||
|
// r.Unlock()
|
||||||
//
|
//
|
||||||
func ProvideRecord(r record.Record) ValueProvider {
|
func ProvideRecord(r record.Record) ValueProvider {
|
||||||
return &singleRecordReader{r}
|
return &singleRecordReader{r}
|
||||||
|
|
Loading…
Add table
Reference in a new issue