policy.mx raw

   1  // Package policy maps an event kind to the storage rule the relay applies to
   2  // it. Musiquay's protocol vocabulary is the source of truth for its own kinds;
   3  // every other kind follows NIP-01.
   4  package pipeline
   5  
   6  import (
   7  	"git.smesh.lol/musiquay/pkg/protocol"
   8  )
   9  
  10  // countedInReplaceableRange reports whether a kind is a Musiquay *counted*
  11  // kind that happens to sit inside NIP-01's parameterized-replaceable range.
  12  //
  13  // 32218 (delivery receipt), 32219 (host aggregate) and 32220 (publisher
  14  // rollup) are 30000-39999, so `kind.IsParameterizedReplaceable` claims them.
  15  // They are not addressable documents: each is one record of many, and with no
  16  // `d` tag the range rule treats them all as d="" and keeps only the newest -
  17  // the second receipt from a host would silently delete the first. The protocol
  18  // says so itself in `protocol.RegularInReplaceableRange`.
  19  func countedInReplaceableRange(k uint16) (ok bool) {
  20  	return protocol.IsRegular(k) && protocol.InReplaceableRange(k)
  21  }
  22