github.com/qri-io/qri@v0.10.1-0.20220104210721-c771715036cb/remote/registry/registry.go (about) 1 /* 2 Package registry defines primitives for keeping centralized repositories 3 of qri types (peers, datasets, etc). It uses classical client/server patterns, 4 arranging types into cannonical stores. 5 6 At first glance, this seems to run against the grain of "decentralize or die" 7 principles espoused by those of us interested in reducing points of failure in 8 a network. Registries offer a way to operate as a federated model, with peers 9 opting-in to a set of norms set forth by a registry. 10 11 It is a long term goal at qri that it be *possible* to fully decentralize all 12 aspects, of qri this isn't practical short-term, and isn't always a desired 13 property. 14 15 As an example, associating human-readable usernames with crypto keypairs is an 16 order of magnitude easier if you just put the damn thing in a list. So that's 17 what this registry does. 18 19 This base package provides common primitives that other packages can import to 20 work with a registry, and subpackages for turning these primitives into usable 21 tools like servers & (eventually) command-line clients 22 */ 23 package registry 24 25 import ( 26 "fmt" 27 28 "github.com/qri-io/qri/remote" 29 ) 30 31 // Registry a collection of interfaces that together form a registry service 32 type Registry struct { 33 Remote *remote.Server 34 Profiles Profiles 35 Search Searchable 36 Indexer Indexer 37 } 38 39 var ( 40 // ErrUsernameTaken is for when a peername is already taken 41 ErrUsernameTaken = fmt.Errorf("username is taken") 42 // ErrNoRegistry represents the lack of a configured registry 43 ErrNoRegistry = fmt.Errorf("no registry is configured") 44 // ErrNotFound represents a missing record 45 ErrNotFound = fmt.Errorf("not found") 46 )