Documentation ¶
Index ¶
- Variables
- type Element
- type OrgUser
- type ReadDB
- func (r *ReadDB) Do(ctx context.Context, f func(tx *db.Tx) error) error
- func (r *ReadDB) GetAllProjects(tx *db.Tx) ([]*types.Project, error)
- func (r *ReadDB) GetChangeGroupsUpdateTokens(tx *db.Tx, groups []string) (*datamanager.ChangeGroupsUpdateToken, error)
- func (r *ReadDB) GetCommittedWalSequence(tx *db.Tx) (string, error)
- func (r *ReadDB) GetOrg(tx *db.Tx, orgRef string) (*types.Organization, error)
- func (r *ReadDB) GetOrgByID(tx *db.Tx, orgID string) (*types.Organization, error)
- func (r *ReadDB) GetOrgByName(tx *db.Tx, name string) (*types.Organization, error)
- func (r *ReadDB) GetOrgMemberByOrgUserID(tx *db.Tx, orgID, userID string) (*types.OrganizationMember, error)
- func (r *ReadDB) GetOrgUsers(tx *db.Tx, orgID string) ([]*OrgUser, error)
- func (r *ReadDB) GetOrgs(tx *db.Tx, startOrgName string, limit int, asc bool) ([]*types.Organization, error)
- func (r *ReadDB) GetPath(tx *db.Tx, configType types.ConfigType, id string) (string, error)
- func (r *ReadDB) GetProject(tx *db.Tx, projectRef string) (*types.Project, error)
- func (r *ReadDB) GetProjectByID(tx *db.Tx, projectID string) (*types.Project, error)
- func (r *ReadDB) GetProjectByName(tx *db.Tx, parentID, name string) (*types.Project, error)
- func (r *ReadDB) GetProjectByPath(tx *db.Tx, projectPath string) (*types.Project, error)
- func (r *ReadDB) GetProjectGroup(tx *db.Tx, projectGroupRef string) (*types.ProjectGroup, error)
- func (r *ReadDB) GetProjectGroupByID(tx *db.Tx, projectGroupID string) (*types.ProjectGroup, error)
- func (r *ReadDB) GetProjectGroupByName(tx *db.Tx, parentID, name string) (*types.ProjectGroup, error)
- func (r *ReadDB) GetProjectGroupByPath(tx *db.Tx, projectGroupPath string) (*types.ProjectGroup, error)
- func (r *ReadDB) GetProjectGroupHierarchy(tx *db.Tx, projectGroup *types.ProjectGroup) ([]*Element, error)
- func (r *ReadDB) GetProjectGroupOwnerID(tx *db.Tx, group *types.ProjectGroup) (types.ConfigType, string, error)
- func (r *ReadDB) GetProjectGroupPath(tx *db.Tx, group *types.ProjectGroup) (string, error)
- func (r *ReadDB) GetProjectGroupProjects(tx *db.Tx, parentID string) ([]*types.Project, error)
- func (r *ReadDB) GetProjectGroupSubgroups(tx *db.Tx, parentID string) ([]*types.ProjectGroup, error)
- func (r *ReadDB) GetProjectOwnerID(tx *db.Tx, project *types.Project) (types.ConfigType, string, error)
- func (r *ReadDB) GetProjectPath(tx *db.Tx, project *types.Project) (string, error)
- func (r *ReadDB) GetRemoteSource(tx *db.Tx, rsRef string) (*types.RemoteSource, error)
- func (r *ReadDB) GetRemoteSourceByID(tx *db.Tx, remoteSourceID string) (*types.RemoteSource, error)
- func (r *ReadDB) GetRemoteSourceByName(tx *db.Tx, name string) (*types.RemoteSource, error)
- func (r *ReadDB) GetRemoteSources(ctx context.Context, startRemoteSourceName string, limit int, asc bool) ([]*types.RemoteSource, error)
- func (r *ReadDB) GetRevision(ctx context.Context) (int64, error)
- func (r *ReadDB) GetSecretByID(tx *db.Tx, secretID string) (*types.Secret, error)
- func (r *ReadDB) GetSecretByName(tx *db.Tx, parentID, name string) (*types.Secret, error)
- func (r *ReadDB) GetSecretTree(tx *db.Tx, parentType types.ConfigType, parentID, name string) (*types.Secret, error)
- func (r *ReadDB) GetSecrets(tx *db.Tx, parentID string) ([]*types.Secret, error)
- func (r *ReadDB) GetSecretsTree(tx *db.Tx, parentType types.ConfigType, parentID string) ([]*types.Secret, error)
- func (r *ReadDB) GetUser(tx *db.Tx, userRef string) (*types.User, error)
- func (r *ReadDB) GetUserByID(tx *db.Tx, userID string) (*types.User, error)
- func (r *ReadDB) GetUserByLinkedAccount(tx *db.Tx, linkedAccountID string) (*types.User, error)
- func (r *ReadDB) GetUserByLinkedAccountRemoteUserIDandSource(tx *db.Tx, remoteUserID, remoteSourceID string) (*types.User, error)
- func (r *ReadDB) GetUserByName(tx *db.Tx, name string) (*types.User, error)
- func (r *ReadDB) GetUserByTokenValue(tx *db.Tx, tokenValue string) (*types.User, error)
- func (r *ReadDB) GetUserOrgs(tx *db.Tx, userID string) ([]*UserOrg, error)
- func (r *ReadDB) GetUsers(tx *db.Tx, startUserName string, limit int, asc bool) ([]*types.User, error)
- func (r *ReadDB) GetVariableByID(tx *db.Tx, variableID string) (*types.Variable, error)
- func (r *ReadDB) GetVariableByName(tx *db.Tx, parentID, name string) (*types.Variable, error)
- func (r *ReadDB) GetVariables(tx *db.Tx, parentID string) ([]*types.Variable, error)
- func (r *ReadDB) GetVariablesTree(tx *db.Tx, parentType types.ConfigType, parentID string) ([]*types.Variable, error)
- func (r *ReadDB) Initialize(ctx context.Context) error
- func (r *ReadDB) IsInitialized() bool
- func (r *ReadDB) ResetDB(ctx context.Context) error
- func (r *ReadDB) ResolveConfigID(tx *db.Tx, configType types.ConfigType, ref string) (string, error)
- func (r *ReadDB) Run(ctx context.Context) error
- func (r *ReadDB) SetInitialized(initialized bool)
- func (r *ReadDB) SyncFromDump(ctx context.Context) (string, error)
- func (r *ReadDB) SyncFromWals(ctx context.Context, startWalSeq, endWalSeq string) (string, error)
- func (r *ReadDB) SyncRDB(ctx context.Context) error
- type UserOrg
Constants ¶
This section is empty.
Variables ¶
View Source
var Stmts = []string{
"create table revision (revision bigint, PRIMARY KEY(revision))",
"create table committedwalsequence (seq varchar, PRIMARY KEY (seq))",
"create table changegrouprevision (id varchar, revision varchar, PRIMARY KEY (id, revision))",
"create table projectgroup (id uuid, name varchar, parentid varchar, parenttype varchar, data bytea, PRIMARY KEY (id))",
"create index projectgroup_name on projectgroup(name)",
"create table project (id uuid, name varchar, parentid varchar, parenttype varchar, data bytea, PRIMARY KEY (id))",
"create index project_name on project(name)",
"create table user (id uuid, name varchar, data bytea, PRIMARY KEY (id))",
"create index user_name on user(name)",
"create table user_token (tokenvalue varchar, userid uuid, PRIMARY KEY (tokenvalue, userid))",
"create table org (id uuid, name varchar, data bytea, PRIMARY KEY (id))",
"create index org_name on org(name)",
"create table orgmember (id uuid, orgid uuid, userid uuid, role varchar, data bytea, PRIMARY KEY (id))",
"create index orgmember_role on orgmember(role)",
"create index orgmember_orgid_userid on orgmember(orgid, userid)",
"create table remotesource (id uuid, name varchar, data bytea, PRIMARY KEY (id))",
"create table linkedaccount_user (id uuid, remotesourceid uuid, userid uuid, remoteuserid uuid, PRIMARY KEY (id), FOREIGN KEY(userid) REFERENCES user(id))",
"create table linkedaccount_project (id uuid, projectid uuid, PRIMARY KEY (id), FOREIGN KEY(projectid) REFERENCES user(id))",
"create table secret (id uuid, name varchar, parentid varchar, parenttype varchar, data bytea, PRIMARY KEY (id))",
"create index secret_name on secret(name)",
"create table variable (id uuid, name varchar, parentid varchar, parenttype varchar, data bytea, PRIMARY KEY (id))",
"create index variable_name on variable(name)",
}
Functions ¶
This section is empty.
Types ¶
type Element ¶
type Element struct { ID string Name string Type types.ConfigType ParentType types.ConfigType ParentID string }
type ReadDB ¶
type ReadDB struct { Initialized bool // contains filtered or unexported fields }
func NewReadDB ¶
func NewReadDB(ctx context.Context, log zerolog.Logger, dataDir string, e *etcd.Store, ost *objectstorage.ObjStorage, dm *datamanager.DataManager) (*ReadDB, error)
func (*ReadDB) GetAllProjects ¶
func (*ReadDB) GetChangeGroupsUpdateTokens ¶
func (r *ReadDB) GetChangeGroupsUpdateTokens(tx *db.Tx, groups []string) (*datamanager.ChangeGroupsUpdateToken, error)
func (*ReadDB) GetCommittedWalSequence ¶
func (*ReadDB) GetOrgByID ¶
func (*ReadDB) GetOrgByName ¶
func (*ReadDB) GetOrgMemberByOrgUserID ¶
func (*ReadDB) GetOrgUsers ¶
TODO(sgotti) implement cursor fetching
func (*ReadDB) GetProject ¶
func (*ReadDB) GetProjectByID ¶
func (*ReadDB) GetProjectByName ¶
func (*ReadDB) GetProjectByPath ¶
func (*ReadDB) GetProjectGroup ¶
func (*ReadDB) GetProjectGroupByID ¶
func (*ReadDB) GetProjectGroupByName ¶
func (*ReadDB) GetProjectGroupByPath ¶
func (*ReadDB) GetProjectGroupHierarchy ¶
func (*ReadDB) GetProjectGroupOwnerID ¶
func (r *ReadDB) GetProjectGroupOwnerID(tx *db.Tx, group *types.ProjectGroup) (types.ConfigType, string, error)
func (*ReadDB) GetProjectGroupPath ¶
func (*ReadDB) GetProjectGroupProjects ¶
func (*ReadDB) GetProjectGroupSubgroups ¶
func (*ReadDB) GetProjectOwnerID ¶
func (*ReadDB) GetProjectPath ¶
func (*ReadDB) GetRemoteSource ¶
func (*ReadDB) GetRemoteSourceByID ¶
func (*ReadDB) GetRemoteSourceByName ¶
func (*ReadDB) GetRemoteSources ¶
func (*ReadDB) GetSecretByID ¶
func (*ReadDB) GetSecretByName ¶
func (*ReadDB) GetSecretTree ¶
func (*ReadDB) GetSecrets ¶
func (*ReadDB) GetSecretsTree ¶
func (*ReadDB) GetUserByID ¶
func (*ReadDB) GetUserByLinkedAccount ¶
func (*ReadDB) GetUserByLinkedAccountRemoteUserIDandSource ¶
func (*ReadDB) GetUserByName ¶
func (*ReadDB) GetUserByTokenValue ¶
func (*ReadDB) GetUserOrgs ¶
TODO(sgotti) implement cursor fetching
func (*ReadDB) GetVariableByID ¶
func (*ReadDB) GetVariableByName ¶
func (*ReadDB) GetVariables ¶
func (*ReadDB) GetVariablesTree ¶
func (*ReadDB) Initialize ¶
Initialize populates the readdb with the current etcd data and save the revision to then feed it with the etcd events
func (*ReadDB) IsInitialized ¶
func (*ReadDB) ResolveConfigID ¶
func (*ReadDB) SetInitialized ¶
func (*ReadDB) SyncFromWals ¶
type UserOrg ¶
type UserOrg struct { Organization *types.Organization Role types.MemberRole }
Click to show internal directories.
Click to hide internal directories.