diff options
Diffstat (limited to 'internal/source/disk/disk.go')
-rw-r--r-- | internal/source/disk/disk.go | 17 |
1 files changed, 4 insertions, 13 deletions
diff --git a/internal/source/disk/disk.go b/internal/source/disk/disk.go index a3ae8901..b79d222d 100644 --- a/internal/source/disk/disk.go +++ b/internal/source/disk/disk.go @@ -24,25 +24,16 @@ func New() *Disk { } } -// GetDomain returns a domain from the domains map -func (d *Disk) GetDomain(host string) *domain.Domain { +// GetDomain returns a domain from the domains map if it exists +func (d *Disk) GetDomain(host string) (*domain.Domain, error) { host = strings.ToLower(host) - d.lock.RLock() - defer d.lock.RUnlock() - domain, _ := d.dm[host] - return domain -} - -// HasDomain checks for presence of a domain in the domains map -func (d *Disk) HasDomain(host string) bool { d.lock.RLock() defer d.lock.RUnlock() - host = strings.ToLower(host) - _, isPresent := d.dm[host] + domain, _ := d.dm[host] - return isPresent + return domain, nil } // IsReady checks if the domains source is ready for work. The disk source is |