Expose name view aliases in lns facade
This commit is contained in:
parent
0cf76807c2
commit
fcd2c20437
3 changed files with 53 additions and 0 deletions
33
lns.go
33
lns.go
|
|
@ -361,6 +361,16 @@ func (s *Service) GetNewClaim() *Claim {
|
|||
return s.NewClaim()
|
||||
}
|
||||
|
||||
// NewNameView constructs an empty cached name-state view.
|
||||
func (s *Service) NewNameView() *NameView {
|
||||
return primitives.NewNameView()
|
||||
}
|
||||
|
||||
// GetNewNameView is an alias for NewNameView.
|
||||
func (s *Service) GetNewNameView() *NameView {
|
||||
return s.NewNameView()
|
||||
}
|
||||
|
||||
// Create constructs a reference NSEC record container.
|
||||
func (s *Service) Create(name, nextDomain string, typeBitmap []byte) NSECRecord {
|
||||
return dnspkg.Create(name, nextDomain, typeBitmap)
|
||||
|
|
@ -1093,6 +1103,19 @@ type NameState = primitives.NameState
|
|||
// NameDelta mirrors the sparse name-state delta type from pkg/primitives.
|
||||
type NameDelta = primitives.NameDelta
|
||||
|
||||
// NameStateGetter mirrors the minimal name-state lookup interface used by
|
||||
// NameView.
|
||||
type NameStateGetter = primitives.NameStateGetter
|
||||
|
||||
// NameView mirrors the cached name-state view used during state processing.
|
||||
type NameView = primitives.NameView
|
||||
|
||||
// NameUndo mirrors the sparse undo payload produced from a NameView.
|
||||
type NameUndo = primitives.NameUndo
|
||||
|
||||
// NameUndoEntry mirrors a single undo entry pairing a hash with a delta.
|
||||
type NameUndoEntry = primitives.NameUndoEntry
|
||||
|
||||
// Claim mirrors the raw ownership-proof claim wrapper from pkg/primitives.
|
||||
type Claim = primitives.Claim
|
||||
|
||||
|
|
@ -1138,6 +1161,16 @@ func GetNewClaim() *Claim {
|
|||
return NewClaim()
|
||||
}
|
||||
|
||||
// NewNameView constructs an empty cached name-state view.
|
||||
func NewNameView() *NameView {
|
||||
return primitives.NewNameView()
|
||||
}
|
||||
|
||||
// GetNewNameView is an alias for NewNameView.
|
||||
func GetNewNameView() *NameView {
|
||||
return NewNameView()
|
||||
}
|
||||
|
||||
// CoinView mirrors the minimal UTXO lookup interface required by covenant
|
||||
// verification helpers.
|
||||
type CoinView = covenant.CoinView
|
||||
|
|
|
|||
|
|
@ -260,6 +260,16 @@ func TestPackageClaimAlias(t *testing.T) {
|
|||
if GetNewClaim() == nil {
|
||||
t.Fatal("GetNewClaim should alias NewClaim")
|
||||
}
|
||||
|
||||
if view := NewNameView(); view == nil {
|
||||
t.Fatal("NewNameView should return a cached name-state view")
|
||||
} else if view.ToNameUndo().Names != nil {
|
||||
t.Fatal("NewNameView should start with an empty undo payload")
|
||||
}
|
||||
|
||||
if GetNewNameView() == nil {
|
||||
t.Fatal("GetNewNameView should alias NewNameView")
|
||||
}
|
||||
}
|
||||
|
||||
func TestPackageNSECAliases(t *testing.T) {
|
||||
|
|
|
|||
10
lns_test.go
10
lns_test.go
|
|
@ -891,6 +891,16 @@ func TestServiceUtilityAliases(t *testing.T) {
|
|||
t.Fatal("GetNewClaim should alias NewClaim")
|
||||
}
|
||||
|
||||
if view := svc.NewNameView(); view == nil {
|
||||
t.Fatal("NewNameView should return a cached name-state view")
|
||||
} else if view.ToNameUndo().Names != nil {
|
||||
t.Fatal("NewNameView should start with an empty undo payload")
|
||||
}
|
||||
|
||||
if svc.GetNewNameView() == nil {
|
||||
t.Fatal("GetNewNameView should alias NewNameView")
|
||||
}
|
||||
|
||||
if got := svc.NextName("ExAmPle."); got != "example\x00." {
|
||||
t.Fatalf("NextName returned %q", got)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue