noop.go 801 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. package db
  2. import (
  3. "crypto/x509"
  4. "github.com/pkg/errors"
  5. )
  6. // ErrNotImplemented is an error returned when an operation is Not Implemented.
  7. var ErrNotImplemented = errors.Errorf("not implemented")
  8. // NoopDB implements the DB interface with Noops
  9. type NoopDB int
  10. // Init noop
  11. func (n *NoopDB) Init(c *Config) (AuthDB, error) {
  12. return n, nil
  13. }
  14. // IsRevoked noop
  15. func (n *NoopDB) IsRevoked(sn string) (bool, error) {
  16. return false, nil
  17. }
  18. // Revoke returns a "NotImplemented" error.
  19. func (n *NoopDB) Revoke(rci *RevokedCertificateInfo) error {
  20. return ErrNotImplemented
  21. }
  22. // StoreCertificate returns a "NotImplemented" error.
  23. func (n *NoopDB) StoreCertificate(crt *x509.Certificate) error {
  24. return ErrNotImplemented
  25. }
  26. // Shutdown returns nil
  27. func (n *NoopDB) Shutdown() error {
  28. return nil
  29. }