Documentation ¶
Index ¶
- func Connect(conf config.StoreConfig) (conn *grpc.ClientConn, err error)
- func NewTrtlBatchIterator(client trtlpb.TrtlClient, namespace string) *trtlBatchIterator
- func NewTrtlStreamingIterator(client trtlpb.TrtlClient, namespace string) *trtlStreamingIterator
- type Store
- func (s *Store) Close() error
- func (s *Store) CountActivityMonth(ctx context.Context) (_ uint64, err error)
- func (s *Store) CountAnnouncementMonths(ctx context.Context) (_ uint64, err error)
- func (s *Store) CountCertReqs(ctx context.Context) (_ uint64, err error)
- func (s *Store) CountCerts(ctx context.Context) (_ uint64, err error)
- func (s *Store) CountContacts(ctx context.Context) (_ uint64, err error)
- func (s *Store) CountOrganizations(ctx context.Context) (_ uint64, err error)
- func (s *Store) CountVASPs(ctx context.Context) (_ uint64, err error)
- func (s *Store) CreateCert(ctx context.Context, c *models.Certificate) (id string, err error)
- func (s *Store) CreateCertReq(ctx context.Context, r *models.CertificateRequest) (id string, err error)
- func (s *Store) CreateContact(ctx context.Context, c *models.Contact) (_ string, err error)
- func (s *Store) CreateOrganization(ctx context.Context, o *bff.Organization) (id string, err error)
- func (s *Store) CreateVASP(ctx context.Context, v *gds.VASP) (id string, err error)
- func (s *Store) DeleteActivityMonth(ctx context.Context, date string) (err error)
- func (s *Store) DeleteAnnouncementMonth(ctx context.Context, date string) (err error)
- func (s *Store) DeleteCert(ctx context.Context, id string) (err error)
- func (s *Store) DeleteCertReq(ctx context.Context, id string) (err error)
- func (s *Store) DeleteContact(ctx context.Context, email string) error
- func (s *Store) DeleteIndices() (err error)
- func (s *Store) DeleteOrganization(ctx context.Context, id uuid.UUID) (err error)
- func (s *Store) DeleteVASP(ctx context.Context, id string) error
- func (s *Store) GetCategoriesIndex() index.MultiIndex
- func (s *Store) GetCountriesIndex() index.MultiIndex
- func (s *Store) GetNamesIndex() index.SingleIndex
- func (s *Store) GetWebsitesIndex() index.SingleIndex
- func (s *Store) ListCertReqs(ctx context.Context) iterator.CertificateRequestIterator
- func (s *Store) ListCerts(ctx context.Context) iterator.CertificateIterator
- func (s *Store) ListContacts(ctx context.Context) []*models.Contact
- func (s *Store) ListOrganizations(ctx context.Context) iterator.OrganizationIterator
- func (s *Store) ListVASPs(ctx context.Context) iterator.DirectoryIterator
- func (s *Store) Reindex() (err error)
- func (s *Store) RetrieveActivityMonth(ctx context.Context, date string) (m *bff.ActivityMonth, err error)
- func (s *Store) RetrieveAnnouncementMonth(ctx context.Context, date string) (m *bff.AnnouncementMonth, err error)
- func (s *Store) RetrieveCert(ctx context.Context, id string) (c *models.Certificate, err error)
- func (s *Store) RetrieveCertReq(ctx context.Context, id string) (r *models.CertificateRequest, err error)
- func (s *Store) RetrieveContact(ctx context.Context, email string) (c *models.Contact, err error)
- func (s *Store) RetrieveOrganization(ctx context.Context, id uuid.UUID) (o *bff.Organization, err error)
- func (s *Store) RetrieveVASP(ctx context.Context, id string) (v *gds.VASP, err error)
- func (s *Store) SearchVASPs(ctx context.Context, query map[string]interface{}) (vasps []*gds.VASP, err error)
- func (s *Store) Sync(index string) error
- func (s *Store) UpdateActivityMonth(ctx context.Context, m *bff.ActivityMonth) (err error)
- func (s *Store) UpdateAnnouncementMonth(ctx context.Context, m *bff.AnnouncementMonth) (err error)
- func (s *Store) UpdateCert(ctx context.Context, c *models.Certificate) (err error)
- func (s *Store) UpdateCertReq(ctx context.Context, r *models.CertificateRequest) (err error)
- func (s *Store) UpdateContact(ctx context.Context, c *models.Contact) (err error)
- func (s *Store) UpdateOrganization(ctx context.Context, o *bff.Organization) (err error)
- func (s *Store) UpdateVASP(ctx context.Context, v *gds.VASP) (err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Connect ¶
func Connect(conf config.StoreConfig) (conn *grpc.ClientConn, err error)
func NewTrtlBatchIterator ¶
func NewTrtlBatchIterator(client trtlpb.TrtlClient, namespace string) *trtlBatchIterator
func NewTrtlStreamingIterator ¶
func NewTrtlStreamingIterator(client trtlpb.TrtlClient, namespace string) *trtlStreamingIterator
Types ¶
type Store ¶
Store implements the store.Store interface for the Trtl replicated database.
func NewMock ¶
func NewMock(conn *grpc.ClientConn) (store *Store, err error)
NewMock creates a mocked trtl store from a custom grpc client connection to enable testing with bufconn. This method avoids the Open method, so the mock will not reindex nor run the checkpointing go routine without an explicit call after mock. However it is important to ensure that all data structures are created in the mock function to avoid panics during testing.
func Open ¶
func Open(conf config.StoreConfig) (store *Store, err error)
Open a connection to the Trtl database.
func (*Store) CountActivityMonth ¶ added in v1.7.4
func (*Store) CountAnnouncementMonths ¶ added in v1.7.4
func (*Store) CountCertReqs ¶ added in v1.7.4
func (*Store) CountCerts ¶ added in v1.7.4
func (*Store) CountContacts ¶ added in v1.7.4
func (*Store) CountOrganizations ¶ added in v1.7.4
func (*Store) CountVASPs ¶ added in v1.7.4
func (*Store) CreateCert ¶
CreateCert and assign a new ID and return the version.
func (*Store) CreateCertReq ¶
func (s *Store) CreateCertReq(ctx context.Context, r *models.CertificateRequest) (id string, err error)
CreateCertReq and assign a new ID and return the version.
func (*Store) CreateContact ¶ added in v1.7.0
CreateContact creates a new Contact record in the store, using the contact's email as a unique ID.
func (*Store) CreateOrganization ¶ added in v1.5.2
CreateOrganization creates a new organization record in the store, assigning a unique ID if it doesn't exist and setting the created and modified timestamps.
func (*Store) CreateVASP ¶
CreateVASP into the directory. This method requires the VASP to have a unique name and ignores any ID fields that are set on the VASP, instead assigning new IDs.
func (*Store) DeleteActivityMonth ¶ added in v1.7.3
DeleteActivityMonth removes an activity month record from the store.
func (*Store) DeleteAnnouncementMonth ¶ added in v1.5.3
DeleteAnnouncementMonth removes an announcement month "crate" from the store.
func (*Store) DeleteCert ¶
DeleteCert removes a certificate from the store.
func (*Store) DeleteCertReq ¶
DeleteCertReq removes a certificate request from the store.
func (*Store) DeleteContact ¶ added in v1.7.0
DeleteContact deletes a contact record from the store by email.
func (*Store) DeleteIndices ¶
DeleteIndices for testing TODO: remove this function in favor of SC-3653
func (*Store) DeleteOrganization ¶ added in v1.5.2
DeleteOrganization deletes an organization record from the store by UUID.
func (*Store) DeleteVASP ¶
DeleteVASP record, removing it completely from the database and indices.
func (*Store) GetCategoriesIndex ¶
func (s *Store) GetCategoriesIndex() index.MultiIndex
GetCategoriesIndex for testing
func (*Store) GetCountriesIndex ¶
func (s *Store) GetCountriesIndex() index.MultiIndex
GetCountriesIndex for testing
func (*Store) GetNamesIndex ¶
func (s *Store) GetNamesIndex() index.SingleIndex
GetNamesIndex for testing
func (*Store) GetWebsitesIndex ¶
func (s *Store) GetWebsitesIndex() index.SingleIndex
GetWebsitesIndex for testing
func (*Store) ListCertReqs ¶
func (s *Store) ListCertReqs(ctx context.Context) iterator.CertificateRequestIterator
ListCertReqs returns all certificate requests that are currently in the store.
func (*Store) ListCerts ¶
func (s *Store) ListCerts(ctx context.Context) iterator.CertificateIterator
ListCerts returns all certificates that are currently in the store.
func (*Store) ListContacts ¶ added in v1.7.0
func (*Store) ListOrganizations ¶ added in v1.6.1
func (s *Store) ListOrganizations(ctx context.Context) iterator.OrganizationIterator
ListOrganizations returns an iterator to retrieve all organizations.
func (*Store) ListVASPs ¶
func (s *Store) ListVASPs(ctx context.Context) iterator.DirectoryIterator
ListVASPs returns an iterator over all VASPs in the database.
func (*Store) Reindex ¶
Reindex rebuilds the name and country indices for the server and synchronizes them back to disk to ensure they're complete and accurate.
func (*Store) RetrieveActivityMonth ¶ added in v1.7.3
func (s *Store) RetrieveActivityMonth(ctx context.Context, date string) (m *bff.ActivityMonth, err error)
RetrieveActivityMonth returns the activity month record for the given date timestamp in the format YYYY-MM.
func (*Store) RetrieveAnnouncementMonth ¶ added in v1.5.2
func (s *Store) RetrieveAnnouncementMonth(ctx context.Context, date string) (m *bff.AnnouncementMonth, err error)
RetrieveAnnouncementMonth returns the announcement month "crate" for the given month timestamp in the format YYYY-MM.
func (*Store) RetrieveCert ¶
RetrieveCert returns a certificate by certificate ID.
func (*Store) RetrieveCertReq ¶
func (s *Store) RetrieveCertReq(ctx context.Context, id string) (r *models.CertificateRequest, err error)
RetrieveCertReq returns a certificate request by certificate request ID.
func (*Store) RetrieveContact ¶ added in v1.7.0
RetrieveContact returns a contact request by contact email.
func (*Store) RetrieveOrganization ¶ added in v1.5.2
func (s *Store) RetrieveOrganization(ctx context.Context, id uuid.UUID) (o *bff.Organization, err error)
RetrieveOrganization retrieves an organization record from the store by UUID.
func (*Store) RetrieveVASP ¶
RetrieveVASP record by id. Returns ErrEntityNotFound if the record does not exist.
func (*Store) SearchVASPs ¶
func (s *Store) SearchVASPs(ctx context.Context, query map[string]interface{}) (vasps []*gds.VASP, err error)
SearchVASPs is intended to specifically identify a VASP (rather than as a browsing functionality). As such it is primarily a filtering search rather than an inclusive search. The query can contain a one or more name or website terms. Names are prefixed matched to the index and websites are hostname matched. The query can contain one or more country and category filters as well, which reduce the number of search results.
func (*Store) Sync ¶
Sync exposes the index synchronization functionality to tests, allowing them to sync a single index or all indices all at once.
func (*Store) UpdateActivityMonth ¶ added in v1.7.3
UpdateActivityMonth creates a new activity month record if it doesn't already exist or replaces the existing record.
func (*Store) UpdateAnnouncementMonth ¶ added in v1.5.2
UpdateAnnouncementMonth creates a new announcement month "crate" if it doesn't already exist or replaces the existing record.
func (*Store) UpdateCert ¶
UpdateCert can create or update a certificate. The certificate should be as complete as possible, including an ID generated by the caller.
func (*Store) UpdateCertReq ¶
UpdateCertReq can create or update a certificate request. The request should be as complete as possible, including an ID generated by the caller.
func (*Store) UpdateContact ¶ added in v1.7.0
UpdateContact can create or update a contact request. The request should be as complete as possible, including an email provided by the caller.
func (*Store) UpdateOrganization ¶ added in v1.5.2
UpdateOrganization updates an organization record in the store by replacing the existing record.