mirror of
https://github.com/safing/portbase
synced 2025-09-09 13:55:47 +00:00
Complete first alpha version
This commit is contained in:
parent
c399d7c748
commit
1ef3ceb274
22 changed files with 299 additions and 159 deletions
|
@ -178,6 +178,9 @@ func (i *Interface) Put(r record.Record) error {
|
|||
return err
|
||||
}
|
||||
|
||||
r.Lock()
|
||||
defer r.Unlock()
|
||||
|
||||
i.options.Apply(r)
|
||||
|
||||
i.updateCache(r)
|
||||
|
@ -191,6 +194,12 @@ func (i *Interface) PutNew(r record.Record) error {
|
|||
return err
|
||||
}
|
||||
|
||||
r.Lock()
|
||||
defer r.Unlock()
|
||||
|
||||
if r.Meta() == nil {
|
||||
r.SetMeta(&record.Meta{})
|
||||
}
|
||||
r.Meta().Reset()
|
||||
i.options.Apply(r)
|
||||
i.updateCache(r)
|
||||
|
@ -296,17 +305,12 @@ func (i *Interface) Subscribe(q *query.Query) (*Subscription, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
c.readLock.Lock()
|
||||
defer c.readLock.Unlock()
|
||||
c.writeLock.Lock()
|
||||
defer c.writeLock.Unlock()
|
||||
|
||||
sub := &Subscription{
|
||||
q: q,
|
||||
local: i.options.Local,
|
||||
internal: i.options.Internal,
|
||||
Feed: make(chan record.Record, 100),
|
||||
}
|
||||
c.subscriptions = append(c.subscriptions, sub)
|
||||
c.addSubscription(sub)
|
||||
return sub, nil
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue