mirror of
https://github.com/safing/portbase
synced 2025-09-09 13:55:47 +00:00
Work on tests and query
This commit is contained in:
parent
014f944b2a
commit
1c7f98d9ba
13 changed files with 288 additions and 88 deletions
|
@ -2,7 +2,6 @@ package database
|
|||
|
||||
import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/tevino/abool"
|
||||
|
||||
|
@ -35,6 +34,11 @@ func (c *Controller) ReadOnly() bool {
|
|||
return c.storage.ReadOnly()
|
||||
}
|
||||
|
||||
// Injected returns whether the storage is injected.
|
||||
func (c *Controller) Injected() bool {
|
||||
return c.storage.Injected()
|
||||
}
|
||||
|
||||
// Get return the record with the given key.
|
||||
func (c *Controller) Get(key string) (record.Record, error) {
|
||||
if shuttingDown.IsSet() {
|
||||
|
@ -53,7 +57,7 @@ func (c *Controller) Get(key string) (record.Record, error) {
|
|||
r.Lock()
|
||||
defer r.Unlock()
|
||||
|
||||
if !r.Meta().CheckValidity(time.Now().Unix()) {
|
||||
if !r.Meta().CheckValidity() {
|
||||
return nil, ErrNotFound
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue