leveldb

package
v1.7.7 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2024 License: MIT Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CopyDB

func CopyDB(src *leveldb.DB, dst *leveldb.DB) (ncopied uint64, err error)

CopyDB is a utility function to copy all the records from one leveldb database object to another.

Types

type Store

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

Store implements store.Store for some basic LevelDB operations and simple protocol buffer storage in a key/value database.

func Open

func Open(path string) (*Store, error)

Open LevelDB directory Store at the specified path.

func (*Store) Backup

func (s *Store) Backup(path string) (err error)

Backup copies the leveldb database to a new directory and archives it as gzip tar. See: https://github.com/wbolster/plyvel/issues/46

func (*Store) Close

func (s *Store) Close() error

Close the database, allowing no further interactions. This method also synchronizes the indices to ensure that they are saved between sessions.

func (*Store) CountActivityMonth added in v1.7.4

func (s *Store) CountActivityMonth(context.Context) (uint64, error)

func (*Store) CountAnnouncementMonths added in v1.7.4

func (s *Store) CountAnnouncementMonths(context.Context) (uint64, error)

func (*Store) CountCertReqs added in v1.7.4

func (s *Store) CountCertReqs(context.Context) (uint64, error)

func (*Store) CountCerts added in v1.7.4

func (s *Store) CountCerts(context.Context) (uint64, error)

func (*Store) CountContacts added in v1.7.4

func (s *Store) CountContacts(context.Context) (uint64, error)

func (*Store) CountOrganizations added in v1.7.4

func (s *Store) CountOrganizations(context.Context) (uint64, error)

func (*Store) CountVASPs added in v1.7.4

func (s *Store) CountVASPs(ctx context.Context) (uint64, error)

func (*Store) CreateCert

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

CreateCertReq 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

func (s *Store) CreateContact(ctx context.Context, c *models.Contact) (_ string, err error)

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

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

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

func (s *Store) CreateVASP(ctx context.Context, v *pb.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) DeleteActivityMonth added in v1.7.3

func (s *Store) DeleteActivityMonth(ctx context.Context, date string) (err error)

DeleteActivityMonth removes an activity month record from the store.

func (*Store) DeleteAnnouncementMonth added in v1.5.3

func (s *Store) DeleteAnnouncementMonth(ctx context.Context, date string) (err error)

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

func (*Store) DeleteCert

func (s *Store) DeleteCert(ctx context.Context, id string) (err error)

DeleteCertReq removes a certificate request from the store.

func (*Store) DeleteCertReq

func (s *Store) DeleteCertReq(ctx context.Context, id string) (err error)

DeleteCertReq removes a certificate request from the store.

func (*Store) DeleteContact added in v1.7.0

func (s *Store) DeleteContact(ctx context.Context, email string) (err error)

DeleteContact deletes an contact record from the store by email.

func (*Store) DeleteOrganization added in v1.5.2

func (s *Store) DeleteOrganization(ctx context.Context, id uuid.UUID) (err error)

DeleteOrganization deletes an organization record from the store by UUID.

func (*Store) DeleteVASP

func (s *Store) DeleteVASP(ctx context.Context, id string) (err error)

DeleteVASP record, removing it completely from the database and indices.

func (*Store) ListCertReqs

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

func (*Store) ListCerts

func (s *Store) ListCerts(ctx context.Context) iterator.CertificateIterator

ListCert returns all certificates that are currently in the store.

func (*Store) ListContacts added in v1.7.0

func (s *Store) ListContacts(ctx context.Context) []*models.Contact

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 all of the 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) 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

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

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

func (s *Store) RetrieveContact(ctx context.Context, email string) (c *models.Contact, err error)

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

func (s *Store) RetrieveVASP(ctx context.Context, id string) (v *pb.VASP, err error)

RetrieveVASP record by id; returns an error if the record does not exist.

func (*Store) SearchVASPs

func (s *Store) SearchVASPs(ctx context.Context, query map[string]interface{}) (vasps []*pb.VASP, err error)

SearchVASPs uses the names and countries index to find VASPs that match the specified query. This is a very simple search and is not intended for robust usage. To find a VASP by name, a case insensitive search is performed if the query exists in any of the VASP entity names. If there is not an exact match a prefix lookup is used so long as the prefix > 3 characters. The search also looks up website matches by parsing urls to match hostnames rather than scheme or path. Finally the query is filtered by country and category.

func (*Store) UpdateActivityMonth added in v1.7.3

func (s *Store) UpdateActivityMonth(ctx context.Context, m *bff.ActivityMonth) (err error)

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

func (s *Store) UpdateAnnouncementMonth(ctx context.Context, 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(ctx context.Context, 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(ctx context.Context, 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) UpdateContact added in v1.7.0

func (s *Store) UpdateContact(ctx context.Context, c *models.Contact) (err error)

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

func (s *Store) UpdateOrganization(ctx context.Context, 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(ctx context.Context, v *pb.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