storage

package
v3.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2020 License: BSD-3-Clause Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CurrentUserVersion                 = 1
	CurrentUserSignedVersion           = 1
	CurrentCellKeyVersion              = 1
	CurrentCellKeySignedVersion        = 1
	CurrentRoleVersion                 = 1
	CurrentRoleSignedVersion           = 1
	CurrentRoleAssignmentVersion       = 1
	CurrentRoleAssignmentSignedVersion = 1
	CurrentGrantKeyVersion             = 1
	CurrentGrantKeySignedVersion       = 1
	CurrentEncryptedGrantVersion       = 1
)

Variables

View Source
var (
	ErrNotFound        = errors.New("not found")
	ErrorAlreadyExists = errors.New("already exists")
)

Functions

This section is empty.

Types

type MariaDBPureStorage

type MariaDBPureStorage struct {
	Serializer *ModelSerializer
	// contains filtered or unexported fields
}

func NewMariaDBPureStorage

func NewMariaDBPureStorage(url string) (*MariaDBPureStorage, error)

func (*MariaDBPureStorage) CleanDB

func (m *MariaDBPureStorage) CleanDB() error

func (*MariaDBPureStorage) DeleteCellKey

func (m *MariaDBPureStorage) DeleteCellKey(userID, dataID string) error

func (*MariaDBPureStorage) DeleteGrantKey

func (m *MariaDBPureStorage) DeleteGrantKey(userID string, keyID []byte) error

func (*MariaDBPureStorage) DeleteRoleAssignments

func (m *MariaDBPureStorage) DeleteRoleAssignments(roleName string, userIDs ...string) error

func (*MariaDBPureStorage) DeleteUser

func (m *MariaDBPureStorage) DeleteUser(userID string, cascade bool) error

func (*MariaDBPureStorage) ExecuteSQL

func (m *MariaDBPureStorage) ExecuteSQL(stmt string) error

func (*MariaDBPureStorage) InitDB

func (m *MariaDBPureStorage) InitDB(cleanGrantKeysIntervalSeconds int) error

func (*MariaDBPureStorage) InsertCellKey

func (m *MariaDBPureStorage) InsertCellKey(key *models.CellKey) error

func (*MariaDBPureStorage) InsertGrantKey

func (m *MariaDBPureStorage) InsertGrantKey(key *models.GrantKey) error

func (*MariaDBPureStorage) InsertRole

func (m *MariaDBPureStorage) InsertRole(role *models.Role) error

func (*MariaDBPureStorage) InsertRoleAssignments

func (m *MariaDBPureStorage) InsertRoleAssignments(assignments ...*models.RoleAssignment) error

func (*MariaDBPureStorage) InsertUser

func (m *MariaDBPureStorage) InsertUser(record *models.UserRecord) error

func (*MariaDBPureStorage) SelectCellKey

func (m *MariaDBPureStorage) SelectCellKey(userID, dataID string) (*models.CellKey, error)

func (*MariaDBPureStorage) SelectGrantKey

func (m *MariaDBPureStorage) SelectGrantKey(userID string, keyID []byte) (*models.GrantKey, error)

func (*MariaDBPureStorage) SelectGrantKeys

func (m *MariaDBPureStorage) SelectGrantKeys(recordVersion uint32) ([]*models.GrantKey, error)

func (*MariaDBPureStorage) SelectRoleAssignment

func (m *MariaDBPureStorage) SelectRoleAssignment(roleName, userID string) (*models.RoleAssignment, error)

func (*MariaDBPureStorage) SelectRoleAssignments

func (m *MariaDBPureStorage) SelectRoleAssignments(userID string) ([]*models.RoleAssignment, error)

func (*MariaDBPureStorage) SelectRoles

func (m *MariaDBPureStorage) SelectRoles(roleNames ...string) ([]*models.Role, error)

func (*MariaDBPureStorage) SelectUser

func (m *MariaDBPureStorage) SelectUser(userID string) (*models.UserRecord, error)

func (*MariaDBPureStorage) SelectUsers

func (m *MariaDBPureStorage) SelectUsers(userIDs ...string) ([]*models.UserRecord, error)

func (*MariaDBPureStorage) SelectUsersByVersion

func (m *MariaDBPureStorage) SelectUsersByVersion(version uint32) ([]*models.UserRecord, error)

func (*MariaDBPureStorage) SetSerializer

func (m *MariaDBPureStorage) SetSerializer(serializer *ModelSerializer)

func (*MariaDBPureStorage) UpdateCellKey

func (m *MariaDBPureStorage) UpdateCellKey(key *models.CellKey) error

func (*MariaDBPureStorage) UpdateGrantKeys

func (m *MariaDBPureStorage) UpdateGrantKeys(keys ...*models.GrantKey) error

func (*MariaDBPureStorage) UpdateUser

func (m *MariaDBPureStorage) UpdateUser(record *models.UserRecord) error

func (*MariaDBPureStorage) UpdateUsers

func (m *MariaDBPureStorage) UpdateUsers(records []*models.UserRecord, previousRecordVersion uint32) error

type ModelSerializer

type ModelSerializer struct {
	SigningKey crypto.PrivateKey
	Crypto     *crypto.Crypto
}

func (*ModelSerializer) GenerateSignature

func (m *ModelSerializer) GenerateSignature(data []byte) ([]byte, error)

func (*ModelSerializer) ParseCellKey

func (m *ModelSerializer) ParseCellKey(key *protos.CellKey) (*models.CellKey, error)

func (*ModelSerializer) ParseGrantKey

func (m *ModelSerializer) ParseGrantKey(key *protos.GrantKey) (*models.GrantKey, error)

func (*ModelSerializer) ParseRole

func (m *ModelSerializer) ParseRole(role *protos.Role) (*models.Role, error)

func (*ModelSerializer) ParseRoleAssignment

func (m *ModelSerializer) ParseRoleAssignment(ra *protos.RoleAssignment) (*models.RoleAssignment, error)

func (*ModelSerializer) ParseUserRecord

func (m *ModelSerializer) ParseUserRecord(rec *protos.UserRecord) (*models.UserRecord, error)

func (*ModelSerializer) SerializeCellKey

func (m *ModelSerializer) SerializeCellKey(key *models.CellKey) (*protos.CellKey, error)

func (*ModelSerializer) SerializeGrantKey

func (m *ModelSerializer) SerializeGrantKey(key *models.GrantKey) (*protos.GrantKey, error)

func (*ModelSerializer) SerializeRole

func (m *ModelSerializer) SerializeRole(role *models.Role) (*protos.Role, error)

func (*ModelSerializer) SerializeRoleAssignment

func (m *ModelSerializer) SerializeRoleAssignment(ra *models.RoleAssignment) (*protos.RoleAssignment, error)

func (*ModelSerializer) SerializeUserRecord

func (m *ModelSerializer) SerializeUserRecord(rec *models.UserRecord) (*protos.UserRecord, error)

func (*ModelSerializer) ValidateSignature

func (m *ModelSerializer) ValidateSignature(data, signature []byte) error

type PureStorage

type PureStorage interface {
	InsertUser(record *models.UserRecord) error
	UpdateUser(record *models.UserRecord) error
	UpdateUsers(records []*models.UserRecord, previousRecordVersion uint32) error
	SelectUser(userID string) (*models.UserRecord, error)
	SelectUsers(userIDs ...string) ([]*models.UserRecord, error)
	SelectUsersByVersion(version uint32) ([]*models.UserRecord, error)
	DeleteUser(userID string, cascade bool) error
	SelectCellKey(userID, dataID string) (*models.CellKey, error)
	InsertCellKey(key *models.CellKey) error
	UpdateCellKey(key *models.CellKey) error
	DeleteCellKey(userID, dataID string) error
	InsertRole(role *models.Role) error
	SelectRoles(roleNames ...string) ([]*models.Role, error)
	InsertRoleAssignments(assignments ...*models.RoleAssignment) error
	SelectRoleAssignments(userID string) ([]*models.RoleAssignment, error)
	SelectRoleAssignment(roleName, userID string) (*models.RoleAssignment, error)
	DeleteRoleAssignments(roleName string, userIDs ...string) error
	InsertGrantKey(key *models.GrantKey) error
	SelectGrantKey(userID string, keyID []byte) (*models.GrantKey, error)
	SelectGrantKeys(recordVersion uint32) ([]*models.GrantKey, error)
	UpdateGrantKeys(keys ...*models.GrantKey) error
	DeleteGrantKey(userID string, keyID []byte) error
}

type SerializerDependentStorage

type SerializerDependentStorage interface {
	SetSerializer(serializer *ModelSerializer)
}

type VirgilCloudPureStorage

type VirgilCloudPureStorage struct {
	Serializer *ModelSerializer
	Client     *clients.PureClient
}

func (*VirgilCloudPureStorage) DeleteCellKey

func (v *VirgilCloudPureStorage) DeleteCellKey(userID, dataID string) error

func (*VirgilCloudPureStorage) DeleteGrantKey

func (v *VirgilCloudPureStorage) DeleteGrantKey(userID string, keyID []byte) error

func (*VirgilCloudPureStorage) DeleteRoleAssignments

func (v *VirgilCloudPureStorage) DeleteRoleAssignments(roleName string, userIDs ...string) error

func (*VirgilCloudPureStorage) DeleteUser

func (v *VirgilCloudPureStorage) DeleteUser(userID string, cascade bool) error

func (*VirgilCloudPureStorage) InsertCellKey

func (v *VirgilCloudPureStorage) InsertCellKey(key *models.CellKey) error

func (*VirgilCloudPureStorage) InsertGrantKey

func (v *VirgilCloudPureStorage) InsertGrantKey(key *models.GrantKey) error

func (*VirgilCloudPureStorage) InsertRole

func (v *VirgilCloudPureStorage) InsertRole(role *models.Role) error

func (*VirgilCloudPureStorage) InsertRoleAssignments

func (v *VirgilCloudPureStorage) InsertRoleAssignments(assignments ...*models.RoleAssignment) error

func (*VirgilCloudPureStorage) InsertUser

func (v *VirgilCloudPureStorage) InsertUser(record *models.UserRecord) error

func (*VirgilCloudPureStorage) SelectCellKey

func (v *VirgilCloudPureStorage) SelectCellKey(userID, dataID string) (*models.CellKey, error)

func (*VirgilCloudPureStorage) SelectGrantKey

func (v *VirgilCloudPureStorage) SelectGrantKey(userID string, keyID []byte) (*models.GrantKey, error)

func (*VirgilCloudPureStorage) SelectGrantKeys

func (v *VirgilCloudPureStorage) SelectGrantKeys(recordVersion uint32) ([]*models.GrantKey, error)

func (*VirgilCloudPureStorage) SelectRoleAssignment

func (v *VirgilCloudPureStorage) SelectRoleAssignment(roleName, userID string) (*models.RoleAssignment, error)

func (*VirgilCloudPureStorage) SelectRoleAssignments

func (v *VirgilCloudPureStorage) SelectRoleAssignments(userID string) ([]*models.RoleAssignment, error)

func (*VirgilCloudPureStorage) SelectRoles

func (v *VirgilCloudPureStorage) SelectRoles(roleNames ...string) ([]*models.Role, error)

func (*VirgilCloudPureStorage) SelectUser

func (v *VirgilCloudPureStorage) SelectUser(userID string) (*models.UserRecord, error)

func (*VirgilCloudPureStorage) SelectUsers

func (v *VirgilCloudPureStorage) SelectUsers(userIDs ...string) ([]*models.UserRecord, error)

func (*VirgilCloudPureStorage) SelectUsersByVersion

func (v *VirgilCloudPureStorage) SelectUsersByVersion(version uint32) ([]*models.UserRecord, error)

func (*VirgilCloudPureStorage) SetSerializer

func (v *VirgilCloudPureStorage) SetSerializer(serializer *ModelSerializer)

func (*VirgilCloudPureStorage) UpdateCellKey

func (v *VirgilCloudPureStorage) UpdateCellKey(key *models.CellKey) error

func (*VirgilCloudPureStorage) UpdateGrantKeys

func (v *VirgilCloudPureStorage) UpdateGrantKeys(keys ...*models.GrantKey) error

func (*VirgilCloudPureStorage) UpdateUser

func (v *VirgilCloudPureStorage) UpdateUser(record *models.UserRecord) error

func (*VirgilCloudPureStorage) UpdateUsers

func (v *VirgilCloudPureStorage) UpdateUsers(records []*models.UserRecord, previousRecordVersion uint32) error

Jump to

Keyboard shortcuts

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