refactor(lns): return exported catalog instances
Co-Authored-By: Virgil <virgil@lethean.io>
This commit is contained in:
parent
26a3492d62
commit
cf01f6ff0c
2 changed files with 14 additions and 6 deletions
12
lns.go
12
lns.go
|
|
@ -1273,7 +1273,7 @@ func (s *Service) HasLockedByHash(hash primitives.Hash) bool {
|
|||
// catalog := svc.ReservedCatalog()
|
||||
// items := catalog.Entries()
|
||||
func (s *Service) ReservedCatalog() *covenant.ReservedCatalog {
|
||||
return covenant.DefaultReservedCatalog()
|
||||
return Reserved
|
||||
}
|
||||
|
||||
// Core returns the Core instance this service is registered with.
|
||||
|
|
@ -1318,7 +1318,7 @@ func DefaultReservedCatalog() *covenant.ReservedCatalog {
|
|||
//
|
||||
// catalog := lns.GetReservedCatalog()
|
||||
func GetReservedCatalog() *covenant.ReservedCatalog {
|
||||
return covenant.DefaultReservedCatalog()
|
||||
return ReservedCatalog()
|
||||
}
|
||||
|
||||
// ReservedSize reports the number of reserved-name entries available to the service.
|
||||
|
|
@ -1427,7 +1427,7 @@ func (s *Service) GetReservedValues() []covenant.ReservedName {
|
|||
// catalog := svc.LockedCatalog()
|
||||
// items := catalog.Entries()
|
||||
func (s *Service) LockedCatalog() *covenant.LockedCatalog {
|
||||
return covenant.DefaultLockedCatalog()
|
||||
return Locked
|
||||
}
|
||||
|
||||
// GetLockedCatalog is an alias for LockedCatalog.
|
||||
|
|
@ -1451,7 +1451,7 @@ func DefaultLockedCatalog() *covenant.LockedCatalog {
|
|||
//
|
||||
// catalog := lns.GetLockedCatalog()
|
||||
func GetLockedCatalog() *covenant.LockedCatalog {
|
||||
return covenant.DefaultLockedCatalog()
|
||||
return LockedCatalog()
|
||||
}
|
||||
|
||||
// Reserved exposes the reserved-name catalog instance used by the package.
|
||||
|
|
@ -1468,14 +1468,14 @@ var Locked = DefaultLockedCatalog()
|
|||
//
|
||||
// catalog := lns.ReservedCatalog()
|
||||
func ReservedCatalog() *covenant.ReservedCatalog {
|
||||
return covenant.DefaultReservedCatalog()
|
||||
return Reserved
|
||||
}
|
||||
|
||||
// LockedCatalog exposes the locked-name catalog used by the package.
|
||||
//
|
||||
// catalog := lns.LockedCatalog()
|
||||
func LockedCatalog() *covenant.LockedCatalog {
|
||||
return covenant.DefaultLockedCatalog()
|
||||
return Locked
|
||||
}
|
||||
|
||||
// ReservedSize reports the number of reserved-name entries available to the package.
|
||||
|
|
|
|||
|
|
@ -1167,6 +1167,10 @@ func TestServiceReservedCatalog(t *testing.T) {
|
|||
t.Fatal("GetReservedCatalog should return a catalog")
|
||||
}
|
||||
|
||||
if catalog != Reserved {
|
||||
t.Fatal("ReservedCatalog should return the exported Reserved instance")
|
||||
}
|
||||
|
||||
if getCatalog != catalog {
|
||||
t.Fatal("GetReservedCatalog should alias ReservedCatalog")
|
||||
}
|
||||
|
|
@ -1279,6 +1283,10 @@ func TestServiceLockedCatalog(t *testing.T) {
|
|||
t.Fatal("GetLockedCatalog should return a catalog")
|
||||
}
|
||||
|
||||
if catalog != Locked {
|
||||
t.Fatal("LockedCatalog should return the exported Locked instance")
|
||||
}
|
||||
|
||||
if getCatalog != catalog {
|
||||
t.Fatal("GetLockedCatalog should alias LockedCatalog")
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue