trtl

package
v1.6.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 2, 2022 License: MIT Imports: 28 Imported by: 0

Documentation

Index

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

type Store struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

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) Close

func (s *Store) Close() error

Close the connection to the database.

func (*Store) CreateCert

func (s *Store) CreateCert(c *models.Certificate) (id string, err error)

CreateCert and assign a new ID and return the version.

func (*Store) CreateCertReq

func (s *Store) CreateCertReq(r *models.CertificateRequest) (id string, err error)

CreateCertReq and assign a new ID and return the version.

func (*Store) CreateOrganization added in v1.5.2

func (s *Store) CreateOrganization(o *bff.Organization) (id string, err error)

CreateOrganization creates a new organization record in the store, assigning a unique ID if it doesn't eixst and setting the created and modified timestamps.

func (*Store) CreateVASP

func (s *Store) CreateVASP(v *gds.VASP) (id string, err error)

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) DeleteAnnouncementMonth added in v1.5.3

func (s *Store) DeleteAnnouncementMonth(date string) (err error)

DeleteAnnouncementMonth removes an announcement month "crate" from the store.

func (*Store) DeleteCert

func (s *Store) DeleteCert(id string) (err error)

DeleteCert removes a certificate from the store.

func (*Store) DeleteCertReq

func (s *Store) DeleteCertReq(id string) (err error)

DeleteCertReq removes a certificate request from the store.

func (*Store) DeleteIndices

func (s *Store) DeleteIndices() (err error)

DeleteIndices for testing TODO: remove this function in favor of SC-3653

func (*Store) DeleteOrganization added in v1.5.2

func (s *Store) DeleteOrganization(id uuid.UUID) (err error)

DeleteOrganization deletes an organization record from the store by UUID.

func (*Store) DeleteVASP

func (s *Store) DeleteVASP(id string) error

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() iterator.CertificateRequestIterator

ListCertReqs returns all certificate requests that are currently in the store.

func (*Store) ListCerts

func (s *Store) ListCerts() iterator.CertificateIterator

ListCerts returns all certificates that are currently in the store.

func (*Store) ListVASPs

func (s *Store) ListVASPs() iterator.DirectoryIterator

ListVASPs returns an iterator over all VASPs in the database.

func (*Store) Reindex

func (s *Store) Reindex() (err error)

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) RetrieveAnnouncementMonth added in v1.5.2

func (s *Store) RetrieveAnnouncementMonth(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

func (s *Store) RetrieveCert(id string) (c *models.Certificate, err error)

RetrieveCert returns a certificate by certificate ID.

func (*Store) RetrieveCertReq

func (s *Store) RetrieveCertReq(id string) (r *models.CertificateRequest, err error)

RetrieveCertReq returns a certificate request by certificate request ID.

func (*Store) RetrieveOrganization added in v1.5.2

func (s *Store) RetrieveOrganization(id uuid.UUID) (o *bff.Organization, err error)

RetrieveOrganization retrieves an organization record from the store by UUID.

func (*Store) RetrieveVASP

func (s *Store) RetrieveVASP(id string) (v *gds.VASP, err error)

RetrieveVASP record by id. Returns ErrEntityNotFound if the record does not exist.

func (*Store) SearchVASPs

func (s *Store) SearchVASPs(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

func (s *Store) Sync(index string) error

Sync exposes the index synchronization functionality to tests, allowing them to sync a single index or all indices all at once.

func (*Store) UpdateAnnouncementMonth added in v1.5.2

func (s *Store) UpdateAnnouncementMonth(m *bff.AnnouncementMonth) (err error)

UpdateAnnouncementMonth creates a new announcement month "crate" if it doesn't already exist or replaces the existing record.

func (*Store) UpdateCert

func (s *Store) UpdateCert(c *models.Certificate) (err error)

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

func (s *Store) UpdateCertReq(r *models.CertificateRequest) (err error)

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) UpdateOrganization added in v1.5.2

func (s *Store) UpdateOrganization(o *bff.Organization) (err error)

UpdateOrganization updates an organization record in the store by replacing the existing record.

func (*Store) UpdateVASP

func (s *Store) UpdateVASP(v *gds.VASP) (err error)

UpdateVASP by the VASP ID (required). This method simply overwrites the entire VASP record and does not update individual fields.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL