Documentation
¶
Index ¶
- Constants
- Variables
- func CreateRandomPad() db2.PadDB
- func RandomString(length int) string
- func ReadToAuthorDB(reader Reader) (*db.AuthorDB, error)
- func ReadToPadDB(reader Reader) (*db.PadDB, error)
- type APIKey
- type APIKeyMethods
- type Account
- type AccountMethods
- type AuditEntry
- type AuthorMethods
- type AuthorPrivacyMethods
- type AuthorRow
- type AuthorSearch
- type ChatMethods
- type ClusterMethods
- type ClusterNode
- type ConsistencyMethods
- type DataStore
- type GroupMethods
- type InstanceFlagMethods
- type LeaderMethods
- type Leadership
- type MemoryDataStore
- func (m *MemoryDataStore) AddOIDCStorageValue(key string, payload string) (string, error)
- func (m *MemoryDataStore) AddRoleAssignment(a RoleAssignment) error
- func (m *MemoryDataStore) AppendAudit(e AuditEntry) error
- func (m *MemoryDataStore) ClaimReadOnlyId(padID string, candidate string) (string, error)
- func (m *MemoryDataStore) ClearChatAuthorship(authorId string) error
- func (m *MemoryDataStore) Close() error
- func (m *MemoryDataStore) ConsumeAuthCode(signature string) (bool, error)
- func (m *MemoryDataStore) CountChatMessagesOfAuthor(authorId string) (int, error)
- func (m *MemoryDataStore) CreateAPIKey(k APIKey) error
- func (m *MemoryDataStore) CreateAccessToken(...) error
- func (m *MemoryDataStore) CreateAccount(a Account) error
- func (m *MemoryDataStore) CreateAuthCode(...) error
- func (m *MemoryDataStore) CreateOIDCSession(...) error
- func (m *MemoryDataStore) CreatePKCE(...) error
- func (m *MemoryDataStore) CreatePad(padID string, padDB db.PadDB) error
- func (m *MemoryDataStore) CreatePad2ReadOnly(padId string, readonlyId string) errordeprecated
- func (m *MemoryDataStore) CreateReadOnly2Pad(padId string, readonlyId string) errordeprecated
- func (m *MemoryDataStore) CreateRefreshToken(...) error
- func (m *MemoryDataStore) CreateRole(r Role) error
- func (m *MemoryDataStore) CreateToken(t Token) error
- func (m *MemoryDataStore) CreateTokenTransfer(t TokenTransfer) error
- func (m *MemoryDataStore) DeleteAPIKey(id string) error
- func (m *MemoryDataStore) DeleteAccessToken(signature string) error
- func (m *MemoryDataStore) DeleteAccessTokensByRequestID(requestID string) error
- func (m *MemoryDataStore) DeleteAccount(id string) error
- func (m *MemoryDataStore) DeleteOIDCSession(signature string) error
- func (m *MemoryDataStore) DeleteOIDCStorageValue(key string) error
- func (m *MemoryDataStore) DeletePKCE(signature string) error
- func (m *MemoryDataStore) DeleteRefreshToken(signature string) error
- func (m *MemoryDataStore) DeleteRole(id string) error
- func (m *MemoryDataStore) DeleteSecretParams(id string) error
- func (m *MemoryDataStore) DoesPadExist(padID string) (*bool, error)
- func (m *MemoryDataStore) DoesSheetExist(padId string) (*bool, error)
- func (m *MemoryDataStore) GetAPIKeyByHash(hash string) (*APIKey, error)
- func (m *MemoryDataStore) GetAccessToken(signature string) (*OAuthTokenRow, error)
- func (m *MemoryDataStore) GetAccount(id string) (*Account, error)
- func (m *MemoryDataStore) GetAccountByUsername(u string) (*Account, error)
- func (m *MemoryDataStore) GetAuthCode(signature string) (*OAuthTokenRow, error)
- func (m *MemoryDataStore) GetAuthor(authorId string) (*db.AuthorDB, error)
- func (m *MemoryDataStore) GetAuthorByMapper(mapper string) (string, error)
- func (m *MemoryDataStore) GetAuthorByToken(token string) (*string, error)
- func (m *MemoryDataStore) GetAuthorIdsOfPadChats(id string) (*[]string, error)
- func (m *MemoryDataStore) GetAuthorRow(authorId string) (*AuthorRow, error)
- func (m *MemoryDataStore) GetAuthors(ids []string) (*[]db.AuthorDB, error)
- func (m *MemoryDataStore) GetChatsOfPad(padId string, start int, end int) (*[]db.ChatMessageDBWithDisplayName, error)
- func (m *MemoryDataStore) GetGroup(groupId string) (*string, error)
- func (m *MemoryDataStore) GetGroups() (*[]string, error)
- func (m *MemoryDataStore) GetInstanceFlag(name string) (*string, error)
- func (m *MemoryDataStore) GetOIDCSession(signature string) (*OAuthTokenRow, error)
- func (m *MemoryDataStore) GetOIDCStorageValue(key string) (*string, error)
- func (m *MemoryDataStore) GetPKCE(signature string) (*OAuthTokenRow, error)
- func (m *MemoryDataStore) GetPad(padID string) (*db.PadDB, error)
- func (m *MemoryDataStore) GetPadByReadOnlyId(readonlyId string) (*string, error)
- func (m *MemoryDataStore) GetPadIds() (*[]string, error)
- func (m *MemoryDataStore) GetPadIdsOfAuthor(authorId string) (*[]string, error)
- func (m *MemoryDataStore) GetPadVersion(padID string) (*PadVersion, error)
- func (m *MemoryDataStore) GetReadOnly2Pad(id string) (*string, error)deprecated
- func (m *MemoryDataStore) GetReadonlyPad(padId string) (*string, error)
- func (m *MemoryDataStore) GetRefreshToken(signature string) (*OAuthRefreshTokenRow, error)
- func (m *MemoryDataStore) GetRevision(padId string, rev int) (*db.PadSingleRevision, error)
- func (m *MemoryDataStore) GetRevisionDeltas(padID string, fromRev, toRev int) ([]RevisionDelta, error)
- func (m *MemoryDataStore) GetRevisionPool(padID string, rev int) (*db.RevPool, error)
- func (m *MemoryDataStore) GetRevisions(padId string, startRev int, endRev int) (*[]db.PadSingleRevision, error)
- func (m *MemoryDataStore) GetRole(id string) (*Role, error)
- func (m *MemoryDataStore) GetServerVersion() (*db.ServerVersion, error)
- func (m *MemoryDataStore) GetSessionById(sessionID string) (*session2.Session, error)
- func (m *MemoryDataStore) GetSheet(padId string) (*db.SheetDB, error)
- func (m *MemoryDataStore) GetSheetOpInfo(padId string, startRev int, endRev int) (*[]db.SheetOpDB, error)
- func (m *MemoryDataStore) GetSheetOps(padId string, startRev int, endRev int) (*[]db.SheetOpDB, error)
- func (m *MemoryDataStore) GetSheetVersion(padId string) (*SheetVersion, error)
- func (m *MemoryDataStore) GetToken(id string) (*Token, error)
- func (m *MemoryDataStore) GetTokenByHash(hash string) (*Token, error)
- func (m *MemoryDataStore) HasAuditEntry(id string) (bool, error)
- func (m *MemoryDataStore) HeartbeatClusterNode(id, address string, now time.Time, users int) error
- func (m *MemoryDataStore) InvalidateAuthCode(signature string) error
- func (m *MemoryDataStore) ListAPIKeys() ([]APIKey, error)
- func (m *MemoryDataStore) ListAccounts() ([]Account, error)
- func (m *MemoryDataStore) ListAudit(limit int) ([]AuditEntry, error)
- func (m *MemoryDataStore) ListClusterNodes(aliveSince time.Time) ([]ClusterNode, error)
- func (m *MemoryDataStore) ListPadIDs(l PadListing) ([]string, error)
- func (m *MemoryDataStore) ListRoleAssignments(accountID string) ([]RoleAssignment, error)
- func (m *MemoryDataStore) ListRoles() ([]Role, error)
- func (m *MemoryDataStore) ListSecretParams(prefix string) (map[string]string, error)
- func (m *MemoryDataStore) ListTokens(accountID string) ([]Token, error)
- func (m *MemoryDataStore) LockPadsExclusive(padIDs []string) (func(), error)
- func (m *MemoryDataStore) MarkAuthorErased(authorId string, at int64) error
- func (m *MemoryDataStore) Ping() error
- func (m *MemoryDataStore) PruneClusterNodes(before time.Time) error
- func (m *MemoryDataStore) QueryPad(offset int, limit int, sortBy string, ascending bool, pattern string) (*db.PadDBSearchResult, error)
- func (m *MemoryDataStore) RemoveChat(padId string) error
- func (m *MemoryDataStore) RemoveClusterNode(id string) error
- func (m *MemoryDataStore) RemoveGroup(groupId string) error
- func (m *MemoryDataStore) RemoveMapperOfAuthor(authorId string) (bool, error)
- func (m *MemoryDataStore) RemovePad(padID string) error
- func (m *MemoryDataStore) RemovePad2ReadOnly(id string) errordeprecated
- func (m *MemoryDataStore) RemoveReadOnly2Pad(id string) errordeprecated
- func (m *MemoryDataStore) RemoveRevisionsOfPad(padId string) error
- func (m *MemoryDataStore) RemoveRoleAssignment(accountID, roleID, padPattern string) error
- func (m *MemoryDataStore) RemoveSessionById(sessionID string) error
- func (m *MemoryDataStore) RemoveSheet(padId string) error
- func (m *MemoryDataStore) RemoveSheetOps(padId string) error
- func (m *MemoryDataStore) RemoveTokenOfAuthor(authorId string) error
- func (m *MemoryDataStore) RemoveTokenTransfersBefore(before time.Time) error
- func (m *MemoryDataStore) ReplaceRevisions(padId string, pad db.PadDB, revisions []db.PadSingleRevision) error
- func (m *MemoryDataStore) ResetSheet(padId string, snapshot string) error
- func (m *MemoryDataStore) RevokeRefreshToken(signature string) error
- func (m *MemoryDataStore) RevokeRefreshTokensByRequestID(requestID string) error
- func (m *MemoryDataStore) SaveAuthor(author db.AuthorDB) error
- func (m *MemoryDataStore) SaveAuthorColor(authorId string, authorColor string) error
- func (m *MemoryDataStore) SaveAuthorName(authorId string, authorName string) error
- func (m *MemoryDataStore) SaveChatHeadOfPad(padId string, head int) error
- func (m *MemoryDataStore) SaveChatMessage(padId string, head int, authorId *string, timestamp int64, text string) error
- func (m *MemoryDataStore) SaveGroup(groupId string) error
- func (m *MemoryDataStore) SaveRevision(padId string, rev int, changeset string, text db.AText, pool db.RevPool, ...) error
- func (m *MemoryDataStore) SaveSecretParams(id string, prefix string, payload string) error
- func (m *MemoryDataStore) SaveServerVersion(version string) error
- func (m *MemoryDataStore) SaveSheet(padId string, head int, snapshot string) error
- func (m *MemoryDataStore) SaveSheetOp(padId string, rev int, op string, authorId *string, timestamp int64) error
- func (m *MemoryDataStore) SearchAuthors(s AuthorSearch) ([]AuthorRow, error)
- func (m *MemoryDataStore) SetAPIKeyDisabled(id string, disabled bool) error
- func (m *MemoryDataStore) SetAuthorByToken(token string, authorId string) error
- func (m *MemoryDataStore) SetAuthorMapper(authorId, mapper string) error
- func (m *MemoryDataStore) SetInstanceFlag(name, value string) (bool, error)
- func (m *MemoryDataStore) SetOIDCStorageValue(key string, payload string) error
- func (m *MemoryDataStore) SetPadPublicStatus(padID string, public bool) error
- func (m *MemoryDataStore) SetPadSavedRevisions(padID string, saved []db.SavedRevision) error
- func (m *MemoryDataStore) SetPadSettings(padID string, settings string) error
- func (m *MemoryDataStore) SetReadOnlyId(padId string, readonlyId string) error
- func (m *MemoryDataStore) SetSessionById(sessionID string, session session2.Session) error
- func (m *MemoryDataStore) TakeTokenTransfer(id string) (*TokenTransfer, error)
- func (m *MemoryDataStore) TouchAPIKey(id string, at time.Time) error
- func (m *MemoryDataStore) TouchAuthor(authorId string, at int64) error
- func (m *MemoryDataStore) TouchLogin(id string, at time.Time) error
- func (m *MemoryDataStore) TouchToken(id string, at time.Time, ip string) error
- func (m *MemoryDataStore) TryLeadership(name string) (Leadership, bool, error)
- func (m *MemoryDataStore) UpdateAccount(a Account) error
- func (m *MemoryDataStore) UpdatePadHead(padID string, head int, pool db.RevPool) error
- func (m *MemoryDataStore) UpdatePadHeadText(padID string, head int, pool db.RevPool, text db.AText) error
- func (m *MemoryDataStore) UpdateRole(r Role) error
- func (m *MemoryDataStore) UpdateToken(t Token) error
- type MySQLOptions
- type MysqlDB
- func (d MysqlDB) AddOIDCStorageValue(key string, payload string) (string, error)
- func (d MysqlDB) AddRoleAssignment(a RoleAssignment) error
- func (d MysqlDB) AppendAudit(e AuditEntry) error
- func (d MysqlDB) ClaimReadOnlyId(padID string, candidate string) (string, error)
- func (d MysqlDB) ClearChatAuthorship(authorId string) error
- func (d MysqlDB) Close() error
- func (d MysqlDB) ConsumeAuthCode(signature string) (bool, error)
- func (d MysqlDB) CountChatMessagesOfAuthor(id string) (int, error)
- func (d MysqlDB) CreateAPIKey(k APIKey) error
- func (d MysqlDB) CreateAccessToken(...) error
- func (d MysqlDB) CreateAccount(a Account) error
- func (d MysqlDB) CreateAuthCode(...) error
- func (d MysqlDB) CreateOIDCSession(...) error
- func (d MysqlDB) CreatePKCE(...) error
- func (d MysqlDB) CreatePad(padID string, padDB db.PadDB) error
- func (d MysqlDB) CreateRefreshToken(...) error
- func (d MysqlDB) CreateRole(r Role) error
- func (d MysqlDB) CreateToken(t Token) error
- func (d MysqlDB) CreateTokenTransfer(t TokenTransfer) error
- func (d MysqlDB) DeleteAPIKey(id string) error
- func (d MysqlDB) DeleteAccessToken(signature string) error
- func (d MysqlDB) DeleteAccessTokensByRequestID(requestID string) error
- func (d MysqlDB) DeleteAccount(id string) error
- func (d MysqlDB) DeleteOIDCSession(signature string) error
- func (d MysqlDB) DeleteOIDCStorageValue(key string) error
- func (d MysqlDB) DeletePKCE(signature string) error
- func (d MysqlDB) DeleteRefreshToken(signature string) error
- func (d MysqlDB) DeleteRole(id string) error
- func (d MysqlDB) DeleteSecretParams(id string) error
- func (d MysqlDB) DoesPadExist(padID string) (*bool, error)
- func (d MysqlDB) DoesSheetExist(padId string) (*bool, error)
- func (d MysqlDB) GetAPIKeyByHash(h string) (*APIKey, error)
- func (d MysqlDB) GetAccessToken(signature string) (*OAuthTokenRow, error)
- func (d MysqlDB) GetAccount(id string) (*Account, error)
- func (d MysqlDB) GetAccountByUsername(u string) (*Account, error)
- func (d MysqlDB) GetAuthCode(signature string) (*OAuthTokenRow, error)
- func (d MysqlDB) GetAuthor(authorId string) (*db.AuthorDB, error)
- func (d MysqlDB) GetAuthorByMapper(m string) (string, error)
- func (d MysqlDB) GetAuthorByToken(token string) (*string, error)
- func (d MysqlDB) GetAuthorIdsOfPadChats(id string) (*[]string, error)
- func (d MysqlDB) GetAuthorRow(id string) (*AuthorRow, error)
- func (d MysqlDB) GetAuthors(ids []string) (*[]db.AuthorDB, error)
- func (d MysqlDB) GetChatsOfPad(padId string, start int, end int) (*[]db.ChatMessageDBWithDisplayName, error)
- func (d MysqlDB) GetGroup(groupId string) (*string, error)
- func (d MysqlDB) GetGroups() (*[]string, error)
- func (d MysqlDB) GetInstanceFlag(name string) (*string, error)
- func (d MysqlDB) GetOIDCSession(signature string) (*OAuthTokenRow, error)
- func (d MysqlDB) GetOIDCStorageValue(key string) (*string, error)
- func (d MysqlDB) GetPKCE(signature string) (*OAuthTokenRow, error)
- func (d MysqlDB) GetPad(padID string) (*db.PadDB, error)
- func (d MysqlDB) GetPadByReadOnlyId(readonlyId string) (*string, error)
- func (d MysqlDB) GetPadIds() (*[]string, error)
- func (d MysqlDB) GetPadIdsOfAuthor(authorId string) (*[]string, error)
- func (d MysqlDB) GetPadVersion(padID string) (*PadVersion, error)
- func (d MysqlDB) GetReadonlyPad(padId string) (*string, error)
- func (d MysqlDB) GetRefreshToken(signature string) (*OAuthRefreshTokenRow, error)
- func (d MysqlDB) GetRevision(padId string, rev int) (*db.PadSingleRevision, error)
- func (d MysqlDB) GetRevisionDeltas(padID string, fromRev, toRev int) ([]RevisionDelta, error)
- func (d MysqlDB) GetRevisionPool(padID string, rev int) (*db.RevPool, error)
- func (d MysqlDB) GetRevisions(padId string, startRev int, endRev int) (*[]db.PadSingleRevision, error)
- func (d MysqlDB) GetRole(id string) (*Role, error)
- func (d MysqlDB) GetServerVersion() (*db.ServerVersion, error)
- func (d MysqlDB) GetSessionById(sessionID string) (*session2.Session, error)
- func (d MysqlDB) GetSheet(padId string) (*db.SheetDB, error)
- func (d MysqlDB) GetSheetOpInfo(padId string, startRev int, endRev int) (*[]db.SheetOpDB, error)
- func (d MysqlDB) GetSheetOps(padId string, startRev int, endRev int) (*[]db.SheetOpDB, error)
- func (d MysqlDB) GetSheetVersion(padId string) (*SheetVersion, error)
- func (d MysqlDB) GetToken(id string) (*Token, error)
- func (d MysqlDB) GetTokenByHash(h string) (*Token, error)
- func (d MysqlDB) HasAuditEntry(id string) (bool, error)
- func (d MysqlDB) HeartbeatClusterNode(id, address string, now time.Time, users int) error
- func (d MysqlDB) InvalidateAuthCode(signature string) error
- func (d MysqlDB) ListAPIKeys() ([]APIKey, error)
- func (d MysqlDB) ListAccounts() ([]Account, error)
- func (d MysqlDB) ListAudit(limit int) ([]AuditEntry, error)
- func (d MysqlDB) ListClusterNodes(aliveSince time.Time) ([]ClusterNode, error)
- func (d MysqlDB) ListPadIDs(l PadListing) ([]string, error)
- func (d MysqlDB) ListRoleAssignments(accountID string) ([]RoleAssignment, error)
- func (d MysqlDB) ListRoles() ([]Role, error)
- func (d MysqlDB) ListSecretParams(prefix string) (map[string]string, error)
- func (d MysqlDB) ListTokens(accountID string) ([]Token, error)
- func (d MysqlDB) LockPadsExclusive(padIDs []string) (func(), error)
- func (d MysqlDB) MarkAuthorErased(id string, at int64) error
- func (d MysqlDB) Ping() error
- func (d MysqlDB) PruneClusterNodes(before time.Time) error
- func (d MysqlDB) QueryPad(offset int, limit int, sortBy string, ascending bool, pattern string) (*db.PadDBSearchResult, error)
- func (d MysqlDB) RemoveChat(padId string) error
- func (d MysqlDB) RemoveClusterNode(id string) error
- func (d MysqlDB) RemoveGroup(groupId string) error
- func (d MysqlDB) RemoveMapperOfAuthor(id string) (bool, error)
- func (d MysqlDB) RemovePad(padID string) error
- func (d MysqlDB) RemoveRevisionsOfPad(padId string) error
- func (d MysqlDB) RemoveRoleAssignment(accountID, roleID, padPattern string) error
- func (d MysqlDB) RemoveSessionById(sid string) error
- func (d MysqlDB) RemoveSheet(padId string) error
- func (d MysqlDB) RemoveSheetOps(padId string) error
- func (d MysqlDB) RemoveTokenOfAuthor(authorId string) error
- func (d MysqlDB) RemoveTokenTransfersBefore(t time.Time) error
- func (d MysqlDB) ReplaceRevisions(padId string, pad db.PadDB, revisions []db.PadSingleRevision) error
- func (d MysqlDB) ResetSheet(padId string, snapshot string) error
- func (d MysqlDB) RevokeRefreshToken(signature string) error
- func (d MysqlDB) RevokeRefreshTokensByRequestID(requestID string) error
- func (d MysqlDB) SaveAuthor(author db.AuthorDB) error
- func (d MysqlDB) SaveAuthorColor(authorId string, authorColor string) error
- func (d MysqlDB) SaveAuthorName(authorId string, authorName string) error
- func (d MysqlDB) SaveChatHeadOfPad(padId string, head int) error
- func (d MysqlDB) SaveChatMessage(padId string, head int, authorId *string, timestamp int64, text string) error
- func (d MysqlDB) SaveGroup(groupId string) error
- func (d MysqlDB) SaveRevision(padId string, rev int, changeset string, text db.AText, pool db.RevPool, ...) error
- func (d MysqlDB) SaveSecretParams(id string, prefix string, payload string) error
- func (d MysqlDB) SaveServerVersion(version string) error
- func (d MysqlDB) SaveSheet(padId string, head int, snapshot string) error
- func (d MysqlDB) SaveSheetOp(padId string, rev int, op string, authorId *string, timestamp int64) error
- func (d MysqlDB) SearchAuthors(s AuthorSearch) ([]AuthorRow, error)
- func (d MysqlDB) SetAPIKeyDisabled(id string, disabled bool) error
- func (d MysqlDB) SetAuthorByToken(token, authorId string) error
- func (d MysqlDB) SetAuthorMapper(id, m string) error
- func (d MysqlDB) SetInstanceFlag(name, value string) (bool, error)
- func (d MysqlDB) SetOIDCStorageValue(key string, payload string) error
- func (d MysqlDB) SetPadPublicStatus(padID string, public bool) error
- func (d MysqlDB) SetPadSavedRevisions(padID string, saved []db.SavedRevision) error
- func (d MysqlDB) SetPadSettings(padID string, settings string) error
- func (d MysqlDB) SetReadOnlyId(padId string, readonlyId string) error
- func (d MysqlDB) SetSessionById(sessionID string, session session2.Session) error
- func (d MysqlDB) TakeTokenTransfer(id string) (*TokenTransfer, error)
- func (d MysqlDB) TouchAPIKey(id string, at time.Time) error
- func (d MysqlDB) TouchAuthor(id string, at int64) error
- func (d MysqlDB) TouchLogin(id string, at time.Time) error
- func (d MysqlDB) TouchToken(id string, at time.Time, ip string) error
- func (d MysqlDB) TryLeadership(name string) (Leadership, bool, error)
- func (d MysqlDB) UpdateAccount(a Account) error
- func (d MysqlDB) UpdatePadHead(padID string, head int, pool db.RevPool) error
- func (d MysqlDB) UpdatePadHeadText(padID string, head int, pool db.RevPool, text db.AText) error
- func (d MysqlDB) UpdateRole(r Role) error
- func (d MysqlDB) UpdateToken(t Token) error
- type OAuthRefreshTokenRow
- type OAuthTokenRow
- type OIDCMethods
- type PadHeadMethods
- type PadListing
- type PadListingMethods
- type PadMeta
- type PadMethods
- type PadVersion
- type PostgresDB
- func (d PostgresDB) AddOIDCStorageValue(key string, payload string) (string, error)
- func (d PostgresDB) AddRoleAssignment(a RoleAssignment) error
- func (d PostgresDB) AppendAudit(e AuditEntry) error
- func (d PostgresDB) ClaimReadOnlyId(padID string, candidate string) (string, error)
- func (d PostgresDB) ClearChatAuthorship(authorId string) error
- func (d PostgresDB) Close() error
- func (d PostgresDB) ConsumeAuthCode(signature string) (bool, error)
- func (d PostgresDB) CountChatMessagesOfAuthor(id string) (int, error)
- func (d PostgresDB) CreateAPIKey(k APIKey) error
- func (d PostgresDB) CreateAccessToken(...) error
- func (d PostgresDB) CreateAccount(a Account) error
- func (d PostgresDB) CreateAuthCode(...) error
- func (d PostgresDB) CreateOIDCSession(...) error
- func (d PostgresDB) CreatePKCE(...) error
- func (d PostgresDB) CreatePad(padID string, padDB db.PadDB) error
- func (d PostgresDB) CreateRefreshToken(...) error
- func (d PostgresDB) CreateRole(r Role) error
- func (d PostgresDB) CreateToken(t Token) error
- func (d PostgresDB) CreateTokenTransfer(t TokenTransfer) error
- func (d PostgresDB) DeleteAPIKey(id string) error
- func (d PostgresDB) DeleteAccessToken(signature string) error
- func (d PostgresDB) DeleteAccessTokensByRequestID(requestID string) error
- func (d PostgresDB) DeleteAccount(id string) error
- func (d PostgresDB) DeleteOIDCSession(signature string) error
- func (d PostgresDB) DeleteOIDCStorageValue(key string) error
- func (d PostgresDB) DeletePKCE(signature string) error
- func (d PostgresDB) DeleteRefreshToken(signature string) error
- func (d PostgresDB) DeleteRole(id string) error
- func (d PostgresDB) DeleteSecretParams(id string) error
- func (d PostgresDB) DoesPadExist(padID string) (*bool, error)
- func (d PostgresDB) DoesSheetExist(padId string) (*bool, error)
- func (d PostgresDB) GetAPIKeyByHash(hash string) (*APIKey, error)
- func (d PostgresDB) GetAccessToken(signature string) (*OAuthTokenRow, error)
- func (d PostgresDB) GetAccount(id string) (*Account, error)
- func (d PostgresDB) GetAccountByUsername(u string) (*Account, error)
- func (d PostgresDB) GetAuthCode(signature string) (*OAuthTokenRow, error)
- func (d PostgresDB) GetAuthor(authorId string) (*db.AuthorDB, error)
- func (d PostgresDB) GetAuthorByMapper(m string) (string, error)
- func (d PostgresDB) GetAuthorByToken(token string) (*string, error)
- func (d PostgresDB) GetAuthorIdsOfPadChats(id string) (*[]string, error)
- func (d PostgresDB) GetAuthorRow(id string) (*AuthorRow, error)
- func (d PostgresDB) GetAuthors(ids []string) (*[]db.AuthorDB, error)
- func (d PostgresDB) GetChatsOfPad(padId string, start int, end int) (*[]db.ChatMessageDBWithDisplayName, error)
- func (d PostgresDB) GetGroup(groupId string) (*string, error)
- func (d PostgresDB) GetGroups() (*[]string, error)
- func (d PostgresDB) GetInstanceFlag(name string) (*string, error)
- func (d PostgresDB) GetOIDCSession(signature string) (*OAuthTokenRow, error)
- func (d PostgresDB) GetOIDCStorageValue(key string) (*string, error)
- func (d PostgresDB) GetPKCE(signature string) (*OAuthTokenRow, error)
- func (d PostgresDB) GetPad(padID string) (*db.PadDB, error)
- func (d PostgresDB) GetPadByReadOnlyId(readonlyId string) (*string, error)
- func (d PostgresDB) GetPadIds() (*[]string, error)
- func (d PostgresDB) GetPadIdsOfAuthor(authorId string) (*[]string, error)
- func (d PostgresDB) GetPadVersion(padID string) (*PadVersion, error)
- func (d PostgresDB) GetReadonlyPad(padId string) (*string, error)
- func (d PostgresDB) GetRefreshToken(signature string) (*OAuthRefreshTokenRow, error)
- func (d PostgresDB) GetRevision(padId string, rev int) (*db.PadSingleRevision, error)
- func (d PostgresDB) GetRevisionDeltas(padID string, fromRev, toRev int) ([]RevisionDelta, error)
- func (d PostgresDB) GetRevisionPool(padID string, rev int) (*db.RevPool, error)
- func (d PostgresDB) GetRevisions(padId string, startRev int, endRev int) (*[]db.PadSingleRevision, error)
- func (d PostgresDB) GetRole(id string) (*Role, error)
- func (d PostgresDB) GetServerVersion() (*db.ServerVersion, error)
- func (d PostgresDB) GetSessionById(sessionID string) (*session2.Session, error)
- func (d PostgresDB) GetSheet(padId string) (*db.SheetDB, error)
- func (d PostgresDB) GetSheetOpInfo(padId string, startRev int, endRev int) (*[]db.SheetOpDB, error)
- func (d PostgresDB) GetSheetOps(padId string, startRev int, endRev int) (*[]db.SheetOpDB, error)
- func (d PostgresDB) GetSheetVersion(padId string) (*SheetVersion, error)
- func (d PostgresDB) GetToken(id string) (*Token, error)
- func (d PostgresDB) GetTokenByHash(h string) (*Token, error)
- func (d PostgresDB) HasAuditEntry(id string) (bool, error)
- func (d PostgresDB) HeartbeatClusterNode(id, address string, now time.Time, users int) error
- func (d PostgresDB) InvalidateAuthCode(signature string) error
- func (d PostgresDB) ListAPIKeys() ([]APIKey, error)
- func (d PostgresDB) ListAccounts() ([]Account, error)
- func (d PostgresDB) ListAudit(limit int) ([]AuditEntry, error)
- func (d PostgresDB) ListClusterNodes(aliveSince time.Time) ([]ClusterNode, error)
- func (d PostgresDB) ListPadIDs(l PadListing) ([]string, error)
- func (d PostgresDB) ListRoleAssignments(accountID string) ([]RoleAssignment, error)
- func (d PostgresDB) ListRoles() ([]Role, error)
- func (d PostgresDB) ListSecretParams(prefix string) (map[string]string, error)
- func (d PostgresDB) ListTokens(accountID string) ([]Token, error)
- func (d PostgresDB) LockPadsExclusive(padIDs []string) (func(), error)
- func (d PostgresDB) MarkAuthorErased(id string, at int64) error
- func (d PostgresDB) Ping() error
- func (d PostgresDB) PruneClusterNodes(before time.Time) error
- func (d PostgresDB) QueryPad(offset int, limit int, sortBy string, ascending bool, pattern string) (*db.PadDBSearchResult, error)
- func (d PostgresDB) RemoveChat(padId string) error
- func (d PostgresDB) RemoveClusterNode(id string) error
- func (d PostgresDB) RemoveGroup(groupId string) error
- func (d PostgresDB) RemoveMapperOfAuthor(id string) (bool, error)
- func (d PostgresDB) RemovePad(padID string) error
- func (d PostgresDB) RemoveRevisionsOfPad(padId string) error
- func (d PostgresDB) RemoveRoleAssignment(accountID, roleID, padPattern string) error
- func (d PostgresDB) RemoveSessionById(sid string) error
- func (d PostgresDB) RemoveSheet(padId string) error
- func (d PostgresDB) RemoveSheetOps(padId string) error
- func (d PostgresDB) RemoveTokenOfAuthor(authorId string) error
- func (d PostgresDB) RemoveTokenTransfersBefore(t time.Time) error
- func (d PostgresDB) ReplaceRevisions(padId string, pad db.PadDB, revisions []db.PadSingleRevision) error
- func (d PostgresDB) ResetSheet(padId string, snapshot string) error
- func (d PostgresDB) RevokeRefreshToken(signature string) error
- func (d PostgresDB) RevokeRefreshTokensByRequestID(requestID string) error
- func (d PostgresDB) SaveAuthor(author db.AuthorDB) error
- func (d PostgresDB) SaveAuthorColor(authorId string, authorColor string) error
- func (d PostgresDB) SaveAuthorName(authorId string, authorName string) error
- func (d PostgresDB) SaveChatHeadOfPad(padId string, head int) error
- func (d PostgresDB) SaveChatMessage(padId string, head int, authorId *string, timestamp int64, text string) error
- func (d PostgresDB) SaveGroup(groupId string) error
- func (d PostgresDB) SaveRevision(padId string, rev int, changeset string, text db.AText, pool db.RevPool, ...) error
- func (d PostgresDB) SaveSecretParams(id string, prefix string, payload string) error
- func (d PostgresDB) SaveServerVersion(version string) error
- func (d PostgresDB) SaveSheet(padId string, head int, snapshot string) error
- func (d PostgresDB) SaveSheetOp(padId string, rev int, op string, authorId *string, timestamp int64) error
- func (d PostgresDB) SearchAuthors(s AuthorSearch) ([]AuthorRow, error)
- func (d PostgresDB) SetAPIKeyDisabled(id string, disabled bool) error
- func (d PostgresDB) SetAuthorByToken(token, authorId string) error
- func (d PostgresDB) SetAuthorMapper(id, m string) error
- func (d PostgresDB) SetInstanceFlag(name, value string) (bool, error)
- func (d PostgresDB) SetOIDCStorageValue(key string, payload string) error
- func (d PostgresDB) SetPadPublicStatus(padID string, public bool) error
- func (d PostgresDB) SetPadSavedRevisions(padID string, saved []db.SavedRevision) error
- func (d PostgresDB) SetPadSettings(padID string, settings string) error
- func (d PostgresDB) SetReadOnlyId(padId string, readonlyId string) error
- func (d PostgresDB) SetSessionById(sessionID string, session session2.Session) error
- func (d PostgresDB) TakeTokenTransfer(id string) (*TokenTransfer, error)
- func (d PostgresDB) TouchAPIKey(id string, at time.Time) error
- func (d PostgresDB) TouchAuthor(id string, at int64) error
- func (d PostgresDB) TouchLogin(id string, at time.Time) error
- func (d PostgresDB) TouchToken(id string, at time.Time, ip string) error
- func (d PostgresDB) TryLeadership(name string) (Leadership, bool, error)
- func (d PostgresDB) UpdateAccount(a Account) error
- func (d PostgresDB) UpdatePadHead(padID string, head int, pool db.RevPool) error
- func (d PostgresDB) UpdatePadHeadText(padID string, head int, pool db.RevPool, text db.AText) error
- func (d PostgresDB) UpdateRole(r Role) error
- func (d PostgresDB) UpdateToken(t Token) error
- type PostgresOptions
- type Reader
- type RevisionDelta
- type Role
- type RoleAssignment
- type SQLiteDB
- func (d SQLiteDB) AddOIDCStorageValue(key string, payload string) (string, error)
- func (d SQLiteDB) AddRoleAssignment(a RoleAssignment) error
- func (d SQLiteDB) AppendAudit(e AuditEntry) error
- func (d SQLiteDB) ClaimReadOnlyId(padID string, candidate string) (string, error)
- func (d SQLiteDB) ClearChatAuthorship(authorId string) error
- func (d SQLiteDB) Close() error
- func (d SQLiteDB) ConsumeAuthCode(signature string) (bool, error)
- func (d SQLiteDB) CountChatMessagesOfAuthor(id string) (int, error)
- func (d SQLiteDB) CreateAPIKey(k APIKey) error
- func (d SQLiteDB) CreateAccessToken(...) error
- func (d SQLiteDB) CreateAccount(a Account) error
- func (d SQLiteDB) CreateAuthCode(...) error
- func (d SQLiteDB) CreateOIDCSession(...) error
- func (d SQLiteDB) CreatePKCE(...) error
- func (d SQLiteDB) CreatePad(padID string, padDB db.PadDB) error
- func (d SQLiteDB) CreateRefreshToken(...) error
- func (d SQLiteDB) CreateRole(r Role) error
- func (d SQLiteDB) CreateToken(t Token) error
- func (d SQLiteDB) CreateTokenTransfer(t TokenTransfer) error
- func (d SQLiteDB) DeleteAPIKey(id string) error
- func (d SQLiteDB) DeleteAccessToken(signature string) error
- func (d SQLiteDB) DeleteAccessTokensByRequestID(requestID string) error
- func (d SQLiteDB) DeleteAccount(id string) error
- func (d SQLiteDB) DeleteOIDCSession(signature string) error
- func (d SQLiteDB) DeleteOIDCStorageValue(key string) error
- func (d SQLiteDB) DeletePKCE(signature string) error
- func (d SQLiteDB) DeleteRefreshToken(signature string) error
- func (d SQLiteDB) DeleteRole(id string) error
- func (d SQLiteDB) DeleteSecretParams(id string) error
- func (d SQLiteDB) DoesPadExist(padID string) (*bool, error)
- func (d SQLiteDB) DoesSheetExist(padId string) (*bool, error)
- func (d SQLiteDB) GetAPIKeyByHash(h string) (*APIKey, error)
- func (d SQLiteDB) GetAccessToken(signature string) (*OAuthTokenRow, error)
- func (d SQLiteDB) GetAccount(id string) (*Account, error)
- func (d SQLiteDB) GetAccountByUsername(u string) (*Account, error)
- func (d SQLiteDB) GetAuthCode(signature string) (*OAuthTokenRow, error)
- func (d SQLiteDB) GetAuthor(authorId string) (*db.AuthorDB, error)
- func (d SQLiteDB) GetAuthorByMapper(m string) (string, error)
- func (d SQLiteDB) GetAuthorByToken(token string) (*string, error)
- func (d SQLiteDB) GetAuthorIdsOfPadChats(id string) (*[]string, error)
- func (d SQLiteDB) GetAuthorRow(id string) (*AuthorRow, error)
- func (d SQLiteDB) GetAuthors(ids []string) (*[]db.AuthorDB, error)
- func (d SQLiteDB) GetChatsOfPad(padId string, start int, end int) (*[]db.ChatMessageDBWithDisplayName, error)
- func (d SQLiteDB) GetGroup(groupId string) (*string, error)
- func (d SQLiteDB) GetGroups() (*[]string, error)
- func (d SQLiteDB) GetInstanceFlag(name string) (*string, error)
- func (d SQLiteDB) GetOIDCSession(signature string) (*OAuthTokenRow, error)
- func (d SQLiteDB) GetOIDCStorageValue(key string) (*string, error)
- func (d SQLiteDB) GetPKCE(signature string) (*OAuthTokenRow, error)
- func (d SQLiteDB) GetPad(padID string) (*db.PadDB, error)
- func (d SQLiteDB) GetPadByReadOnlyId(readonlyId string) (*string, error)
- func (d SQLiteDB) GetPadIds() (*[]string, error)
- func (d SQLiteDB) GetPadIdsOfAuthor(authorId string) (*[]string, error)
- func (d SQLiteDB) GetPadVersion(padID string) (*PadVersion, error)
- func (d SQLiteDB) GetReadonlyPad(padId string) (*string, error)
- func (d SQLiteDB) GetRefreshToken(signature string) (*OAuthRefreshTokenRow, error)
- func (d SQLiteDB) GetRevision(padId string, rev int) (*db.PadSingleRevision, error)
- func (d SQLiteDB) GetRevisionDeltas(padID string, fromRev, toRev int) ([]RevisionDelta, error)
- func (d SQLiteDB) GetRevisionPool(padID string, rev int) (*db.RevPool, error)
- func (d SQLiteDB) GetRevisions(padId string, startRev int, endRev int) (*[]db.PadSingleRevision, error)
- func (d SQLiteDB) GetRole(id string) (*Role, error)
- func (d SQLiteDB) GetServerVersion() (*db.ServerVersion, error)
- func (d SQLiteDB) GetSessionById(sessionID string) (*session2.Session, error)
- func (d SQLiteDB) GetSheet(padId string) (*db.SheetDB, error)
- func (d SQLiteDB) GetSheetOpInfo(padId string, startRev int, endRev int) (*[]db.SheetOpDB, error)
- func (d SQLiteDB) GetSheetOps(padId string, startRev int, endRev int) (*[]db.SheetOpDB, error)
- func (d SQLiteDB) GetSheetVersion(padId string) (*SheetVersion, error)
- func (d SQLiteDB) GetToken(id string) (*Token, error)
- func (d SQLiteDB) GetTokenByHash(h string) (*Token, error)
- func (d SQLiteDB) HasAuditEntry(id string) (bool, error)
- func (d SQLiteDB) HeartbeatClusterNode(id, address string, now time.Time, users int) error
- func (d SQLiteDB) InvalidateAuthCode(signature string) error
- func (d SQLiteDB) ListAPIKeys() ([]APIKey, error)
- func (d SQLiteDB) ListAccounts() ([]Account, error)
- func (d SQLiteDB) ListAudit(limit int) ([]AuditEntry, error)
- func (d SQLiteDB) ListClusterNodes(aliveSince time.Time) ([]ClusterNode, error)
- func (d SQLiteDB) ListPadIDs(l PadListing) ([]string, error)
- func (d SQLiteDB) ListRoleAssignments(accountID string) ([]RoleAssignment, error)
- func (d SQLiteDB) ListRoles() ([]Role, error)
- func (d SQLiteDB) ListSecretParams(prefix string) (map[string]string, error)
- func (d SQLiteDB) ListTokens(accountID string) ([]Token, error)
- func (d SQLiteDB) LockPadsExclusive(padIDs []string) (func(), error)
- func (d SQLiteDB) MarkAuthorErased(id string, at int64) error
- func (d SQLiteDB) Ping() error
- func (d SQLiteDB) PruneClusterNodes(before time.Time) error
- func (d SQLiteDB) QueryPad(offset int, limit int, sortBy string, ascending bool, pattern string) (*db.PadDBSearchResult, error)
- func (d SQLiteDB) RemoveChat(padId string) error
- func (d SQLiteDB) RemoveClusterNode(id string) error
- func (d SQLiteDB) RemoveGroup(groupId string) error
- func (d SQLiteDB) RemoveMapperOfAuthor(id string) (bool, error)
- func (d SQLiteDB) RemovePad(padID string) error
- func (d SQLiteDB) RemoveRevisionsOfPad(padId string) error
- func (d SQLiteDB) RemoveRoleAssignment(accountID, roleID, padPattern string) error
- func (d SQLiteDB) RemoveSessionById(sid string) error
- func (d SQLiteDB) RemoveSheet(padId string) error
- func (d SQLiteDB) RemoveSheetOps(padId string) error
- func (d SQLiteDB) RemoveTokenOfAuthor(authorId string) error
- func (d SQLiteDB) RemoveTokenTransfersBefore(t time.Time) error
- func (d SQLiteDB) ReplaceRevisions(padId string, pad db.PadDB, revisions []db.PadSingleRevision) error
- func (d SQLiteDB) ResetSheet(padId string, snapshot string) error
- func (d SQLiteDB) RevokeRefreshToken(signature string) error
- func (d SQLiteDB) RevokeRefreshTokensByRequestID(requestID string) error
- func (d SQLiteDB) SaveAuthor(author db.AuthorDB) error
- func (d SQLiteDB) SaveAuthorColor(authorId string, authorColor string) error
- func (d SQLiteDB) SaveAuthorName(authorId string, authorName string) error
- func (d SQLiteDB) SaveChatHeadOfPad(padId string, head int) error
- func (d SQLiteDB) SaveChatMessage(padId string, head int, authorId *string, timestamp int64, text string) error
- func (d SQLiteDB) SaveGroup(groupId string) error
- func (d SQLiteDB) SaveRevision(padId string, rev int, changeset string, text db.AText, pool db.RevPool, ...) error
- func (d SQLiteDB) SaveSecretParams(id string, prefix string, payload string) error
- func (d SQLiteDB) SaveServerVersion(version string) error
- func (d SQLiteDB) SaveSheet(padId string, head int, snapshot string) error
- func (d SQLiteDB) SaveSheetOp(padId string, rev int, op string, authorId *string, timestamp int64) error
- func (d SQLiteDB) SearchAuthors(s AuthorSearch) ([]AuthorRow, error)
- func (d SQLiteDB) SetAPIKeyDisabled(id string, disabled bool) error
- func (d SQLiteDB) SetAuthorByToken(token, authorId string) error
- func (d SQLiteDB) SetAuthorMapper(id, m string) error
- func (d SQLiteDB) SetInstanceFlag(name, value string) (bool, error)
- func (d SQLiteDB) SetOIDCStorageValue(key string, payload string) error
- func (d SQLiteDB) SetPadPublicStatus(padID string, public bool) error
- func (d SQLiteDB) SetPadSavedRevisions(padID string, saved []db.SavedRevision) error
- func (d SQLiteDB) SetPadSettings(padID string, settings string) error
- func (d SQLiteDB) SetReadOnlyId(padId string, readonlyId string) error
- func (d SQLiteDB) SetSessionById(sessionID string, session session2.Session) error
- func (d SQLiteDB) TakeTokenTransfer(id string) (*TokenTransfer, error)
- func (d SQLiteDB) TouchAPIKey(id string, at time.Time) error
- func (d SQLiteDB) TouchAuthor(id string, at int64) error
- func (d SQLiteDB) TouchLogin(id string, at time.Time) error
- func (d SQLiteDB) TouchToken(id string, at time.Time, ip string) error
- func (d SQLiteDB) TryLeadership(name string) (Leadership, bool, error)
- func (d SQLiteDB) UpdateAccount(a Account) error
- func (d SQLiteDB) UpdatePadHead(padID string, head int, pool db.RevPool) error
- func (d SQLiteDB) UpdatePadHeadText(padID string, head int, pool db.RevPool, text db.AText) error
- func (d SQLiteDB) UpdateRole(r Role) error
- func (d SQLiteDB) UpdateToken(t Token) error
- type SecretMethods
- type ServerMethods
- type SessionMethods
- type SheetMethods
- type SheetVersion
- type Token
- type TokenMethods
- type TokenTransfer
Constants ¶
const AuthorNotFoundError = "author not found"
const PadDoesNotExistError = "pad not found"
const PadReadOnlyIdNotFoundError = "pad read only id not found"
const PadRevisionNotFoundError = "pad revision not found"
const SessionNotFoundError = "session not found"
const SheetDoesNotExistError = "sheet does not exist"
Variables ¶
var ( // ErrAccountNotFound is returned for an unknown account id. ErrAccountNotFound = errors.New("account not found") // ErrRoleNotFound is returned for an unknown role id. ErrRoleNotFound = errors.New("role not found") // ErrAssignmentNotFound is returned for an unknown role assignment. ErrAssignmentNotFound = errors.New("role assignment not found") )
var ErrAPIKeyNotFound = errors.New("api key not found")
ErrAPIKeyNotFound is returned for an unknown key id.
var ErrConflict = errors.New("already exists")
ErrConflict is returned by SaveRevision and SaveChatMessage when the revision or chat message number is already taken. Another writer (for instance another Etherpad instance on the same database) got there first; the caller must catch up and retry. It is never silently ignored, because that would drop a change the client was told was saved.
var ErrMapperTaken = errors.New("mapper belongs to another author")
ErrMapperTaken: another author already has the mapper (unique since migration 16, so two concurrent first uses cannot both get it).
var ErrTokenNotFound = errors.New("token not found")
ErrTokenNotFound is returned when a token does not exist.
var ErrTokenTransferNotFound = errors.New("token transfer not found")
ErrTokenTransferNotFound is returned for an unknown or redeemed code.
Functions ¶
func CreateRandomPad ¶ added in v0.0.2
func RandomString ¶ added in v0.0.4
Types ¶
type APIKey ¶ added in v0.7.0
type APIKey struct {
ID string
Description string
// Prefix is the start of the key, to tell keys apart.
Prefix string
Hash string
CreatedAt time.Time
// LastUsed is nil for a key never used.
LastUsed *time.Time
Disabled bool
}
APIKey is a key for the HTTP API (/api), created in the admin UI. Only a hash of the key is stored; the key itself is shown once, when it is created.
type APIKeyMethods ¶ added in v0.7.0
type APIKeyMethods interface {
CreateAPIKey(key APIKey) error
// ListAPIKeys returns the keys, oldest first.
ListAPIKeys() ([]APIKey, error)
// GetAPIKeyByHash returns the key with this hash, or nil.
GetAPIKeyByHash(hash string) (*APIKey, error)
SetAPIKeyDisabled(id string, disabled bool) error
DeleteAPIKey(id string) error
// TouchAPIKey records that the key was used at.
TouchAPIKey(id string, at time.Time) error
}
APIKeyMethods store the API keys.
type Account ¶ added in v0.7.0
type Account struct {
ID string
Username string
DisplayName string
Email string
// Kind is "human", "service" or "anonymous".
Kind string
// PasswordHash is empty for accounts without a password.
PasswordHash string
MustChangePassword bool
DisabledAt *time.Time
// AuthorID links the account to its pad author, "" until it wrote.
AuthorID string
CreatedAt time.Time
LastLoginAt *time.Time
}
Account is a person who logs in, a service account that only owns tokens, or the built-in anonymous account of visitors who are not logged in (lib/accounts).
type AccountMethods ¶ added in v0.7.0
type AccountMethods interface {
CreateAccount(a Account) error
// GetAccount returns the account, or nil.
GetAccount(id string) (*Account, error)
// GetAccountByUsername returns the account, or nil.
GetAccountByUsername(username string) (*Account, error)
// ListAccounts returns all accounts, oldest first.
ListAccounts() ([]Account, error)
UpdateAccount(a Account) error
// DeleteAccount removes the account and its assignments.
DeleteAccount(id string) error
CreateRole(r Role) error
// GetRole returns the role, or nil.
GetRole(id string) (*Role, error)
// ListRoles returns all roles by name.
ListRoles() ([]Role, error)
UpdateRole(r Role) error
// DeleteRole removes the role, its assignments and its inclusion in
// other roles.
DeleteRole(id string) error
// AddRoleAssignment stores a; the same account, role and pattern
// again is ErrConflict.
AddRoleAssignment(a RoleAssignment) error
RemoveRoleAssignment(accountID, roleID, padPattern string) error
// ListRoleAssignments returns the assignments of the account, or of
// all accounts for "".
ListRoleAssignments(accountID string) ([]RoleAssignment, error)
// TouchLogin sets only the last login time of an account.
TouchLogin(id string, at time.Time) error
// AppendAudit stores e; an id that exists is ErrConflict.
AppendAudit(e AuditEntry) error
// ListAudit returns the newest entries first, at most limit.
ListAudit(limit int) ([]AuditEntry, error)
// HasAuditEntry reports whether an entry with this id exists.
HasAuditEntry(id string) (bool, error)
}
AccountMethods store accounts, roles, their assignments and the audit log. Create methods return ErrConflict for a taken id or username.
type AuditEntry ¶ added in v0.7.0
type AuditEntry struct {
ID string
At time.Time
ActorID string
Action string
Target string
Details string
}
AuditEntry records a change to accounts, roles or assignments.
type AuthorMethods ¶
type AuthorMethods interface {
GetAuthor(author string) (*db.AuthorDB, error)
GetPadIdsOfAuthor(authorId string) (*[]string, error)
GetAuthorByToken(token string) (*string, error)
SetAuthorByToken(token string, author string) error
SaveAuthor(author db.AuthorDB) error
SaveAuthorName(authorId string, authorName string) error
SaveAuthorColor(authorId string, authorColor string) error
GetAuthors(ids []string) (*[]db.AuthorDB, error)
// RemoveTokenOfAuthor severs the token binding that links a person to the
// given author id (GDPR erasure). It is a no-op if the author does not
// exist or has no token.
RemoveTokenOfAuthor(authorId string) error
}
type AuthorPrivacyMethods ¶ added in v0.7.0
type AuthorPrivacyMethods interface {
// GetAuthorByMapper returns the author created for mapper, or "".
GetAuthorByMapper(mapper string) (string, error)
SetAuthorMapper(authorId string, mapper string) error
// RemoveMapperOfAuthor drops the mapper and reports whether there was one.
RemoveMapperOfAuthor(authorId string) (bool, error)
// TouchAuthor records that the author was seen at (ms).
TouchAuthor(authorId string, at int64) error
// GetAuthorRow returns the author, or nil.
GetAuthorRow(authorId string) (*AuthorRow, error)
MarkAuthorErased(authorId string, at int64) error
CountChatMessagesOfAuthor(authorId string) (int, error)
SearchAuthors(s AuthorSearch) ([]AuthorRow, error)
CreateTokenTransfer(t TokenTransfer) error
// TakeTokenTransfer removes and returns the transfer: it is redeemed at
// most once, also by two requests at the same time.
TakeTokenTransfer(id string) (*TokenTransfer, error)
// RemoveTokenTransfersBefore drops transfers created before t.
RemoveTokenTransfersBefore(t time.Time) error
}
AuthorPrivacyMethods are the author data of erasure (GDPR Art. 17), the admin's author list and the token transfer.
type AuthorRow ¶ added in v0.7.0
type AuthorRow struct {
ID string
Name *string
ColorId string
Mapper *string
LastSeen int64 // ms, 0 unknown
Erased bool
ErasedAt int64 // ms, 0 not erased
}
AuthorRow is an author as the admin's author list shows it.
type AuthorSearch ¶ added in v0.7.0
type AuthorSearch struct {
// Pattern is matched, case-insensitively, against the id, name and
// mapper; "" matches every author.
Pattern string
IncludeErased bool
// SortBy is "name" or "lastSeen".
SortBy string
Ascending bool
// Cap is the most rows returned.
Cap int
}
AuthorSearch selects authors for the admin's list.
type ChatMethods ¶
type ChatMethods interface {
RemoveChat(padId string) error
SaveChatMessage(padId string, head int, authorId *string, timestamp int64, text string) error
GetChatsOfPad(padId string, start int, end int) (*[]db.ChatMessageDBWithDisplayName, error)
GetAuthorIdsOfPadChats(id string) (*[]string, error)
// ClearChatAuthorship nulls the authorship of all chat messages posted by
// the given author while preserving the messages themselves (GDPR erasure).
ClearChatAuthorship(authorId string) error
}
type ClusterMethods ¶ added in v0.7.0
type ClusterMethods interface {
// HeartbeatClusterNode records the instance as alive at now, with its
// connected users.
HeartbeatClusterNode(id, address string, now time.Time, users int) error
ListClusterNodes(aliveSince time.Time) ([]ClusterNode, error)
RemoveClusterNode(id string) error
// PruneClusterNodes removes instances not seen since before.
PruneClusterNodes(before time.Time) error
}
ClusterMethods are the instance registry: every instance records its gossip address and refreshes it periodically; the others join it.
type ClusterNode ¶ added in v0.7.0
type ClusterNode struct {
ID string
Address string
LastSeen time.Time
// Users is the instance's connected users at its last heartbeat.
Users int
}
ClusterNode is an Etherpad instance registered for discovery.
type ConsistencyMethods ¶ added in v0.7.0
type ConsistencyMethods interface {
// GetPadVersion returns the highest stored revision and chat message.
GetPadVersion(padID string) (*PadVersion, error)
// GetRevisionDeltas returns the changesets of revisions fromRev..toRev
// (inclusive, ascending).
GetRevisionDeltas(padID string, fromRev, toRev int) ([]RevisionDelta, error)
// GetRevisionPool returns the attribute pool stored with rev.
GetRevisionPool(padID string, rev int) (*db.RevPool, error)
// LockPadsExclusive takes the locks of all padIDs, which must be
// sorted and unique, excluding every other holder on the same
// database, also in other processes. It takes all or none: on error
// nothing is held. Datastores that only one process uses lock within
// the process.
LockPadsExclusive(padIDs []string) (release func(), err error)
}
ConsistencyMethods let several Etherpad instances share one database. The revisions in padRev are the authoritative pad state; the pad row and each instance's cached pad are derived from them.
type DataStore ¶
type DataStore interface {
PadMethods
AuthorMethods
SessionMethods
GroupMethods
ChatMethods
ServerMethods
OIDCMethods
SecretMethods
SheetMethods
ConsistencyMethods
ClusterMethods
APIKeyMethods
AccountMethods
TokenMethods
InstanceFlagMethods
PadListingMethods
AuthorPrivacyMethods
PadHeadMethods
LeaderMethods
Close() error
Ping() error
}
type GroupMethods ¶
type InstanceFlagMethods ¶ added in v0.7.0
type InstanceFlagMethods interface {
// GetInstanceFlag returns the value of a flag, nil when it is not set.
GetInstanceFlag(name string) (*string, error)
// SetInstanceFlag sets a flag unless it is set; it reports whether
// this call set it (false: it was set, also by another instance).
SetInstanceFlag(name, value string) (bool, error)
}
InstanceFlagMethods store flags of the instance: steps that ran once for the whole database. A flag is set once and never changed.
type LeaderMethods ¶ added in v0.7.0
type LeaderMethods interface {
// TryLeadership takes the named leader lock if it is free. It never
// waits: ok is false when another instance holds it.
TryLeadership(name string) (lease Leadership, ok bool, err error)
}
LeaderMethods elect one instance among those sharing a database to run a background job. The lock is tied to a database connection, so when an instance dies the database releases it and another instance takes over.
type Leadership ¶ added in v0.7.0
type Leadership interface {
Alive() error
Release()
}
Leadership is a held leader lock. Release gives it up; Alive reports an error once the lock may have been lost (for example because the database connection holding it broke), after which the holder must stop acting as leader.
type MemoryDataStore ¶
type MemoryDataStore struct {
// contains filtered or unexported fields
}
func NewMemoryDataStore ¶
func NewMemoryDataStore() *MemoryDataStore
func (*MemoryDataStore) AddOIDCStorageValue ¶ added in v0.7.0
func (m *MemoryDataStore) AddOIDCStorageValue(key string, payload string) (string, error)
func (*MemoryDataStore) AddRoleAssignment ¶ added in v0.7.0
func (m *MemoryDataStore) AddRoleAssignment(a RoleAssignment) error
func (*MemoryDataStore) AppendAudit ¶ added in v0.7.0
func (m *MemoryDataStore) AppendAudit(e AuditEntry) error
func (*MemoryDataStore) ClaimReadOnlyId ¶ added in v0.7.0
func (m *MemoryDataStore) ClaimReadOnlyId(padID string, candidate string) (string, error)
func (*MemoryDataStore) ClearChatAuthorship ¶ added in v0.6.3
func (m *MemoryDataStore) ClearChatAuthorship(authorId string) error
func (*MemoryDataStore) Close ¶ added in v0.0.2
func (m *MemoryDataStore) Close() error
func (*MemoryDataStore) ConsumeAuthCode ¶ added in v0.7.0
func (m *MemoryDataStore) ConsumeAuthCode(signature string) (bool, error)
func (*MemoryDataStore) CountChatMessagesOfAuthor ¶ added in v0.7.0
func (m *MemoryDataStore) CountChatMessagesOfAuthor(authorId string) (int, error)
func (*MemoryDataStore) CreateAPIKey ¶ added in v0.7.0
func (m *MemoryDataStore) CreateAPIKey(k APIKey) error
func (*MemoryDataStore) CreateAccessToken ¶ added in v0.5.0
func (m *MemoryDataStore) CreateAccessToken(signature, clientID, requestID, scopes, grantedScopes, formData, sessionData string, requestedAt, expiresAt time.Time) error
func (*MemoryDataStore) CreateAccount ¶ added in v0.7.0
func (m *MemoryDataStore) CreateAccount(a Account) error
func (*MemoryDataStore) CreateAuthCode ¶ added in v0.5.0
func (m *MemoryDataStore) CreateAuthCode(signature, clientID, requestID, scopes, grantedScopes, formData, sessionData string, requestedAt, expiresAt time.Time) error
func (*MemoryDataStore) CreateOIDCSession ¶ added in v0.5.0
func (m *MemoryDataStore) CreateOIDCSession(signature, clientID, requestID, scopes, grantedScopes, formData, sessionData string, requestedAt, expiresAt time.Time) error
func (*MemoryDataStore) CreatePKCE ¶ added in v0.5.0
func (m *MemoryDataStore) CreatePKCE(signature, clientID, requestID, scopes, grantedScopes, formData, sessionData string, requestedAt, expiresAt time.Time) error
func (*MemoryDataStore) CreatePad ¶
func (m *MemoryDataStore) CreatePad(padID string, padDB db.PadDB) error
func (*MemoryDataStore) CreatePad2ReadOnly
deprecated
func (m *MemoryDataStore) CreatePad2ReadOnly(padId string, readonlyId string) error
Deprecated: Use SetReadOnlyId instead
func (*MemoryDataStore) CreateReadOnly2Pad
deprecated
func (m *MemoryDataStore) CreateReadOnly2Pad(padId string, readonlyId string) error
Deprecated: Use SetReadOnlyId instead - readonly2pad is derived from pad store
func (*MemoryDataStore) CreateRefreshToken ¶ added in v0.5.0
func (*MemoryDataStore) CreateRole ¶ added in v0.7.0
func (m *MemoryDataStore) CreateRole(r Role) error
func (*MemoryDataStore) CreateToken ¶ added in v0.7.0
func (m *MemoryDataStore) CreateToken(t Token) error
func (*MemoryDataStore) CreateTokenTransfer ¶ added in v0.7.0
func (m *MemoryDataStore) CreateTokenTransfer(t TokenTransfer) error
func (*MemoryDataStore) DeleteAPIKey ¶ added in v0.7.0
func (m *MemoryDataStore) DeleteAPIKey(id string) error
func (*MemoryDataStore) DeleteAccessToken ¶ added in v0.5.0
func (m *MemoryDataStore) DeleteAccessToken(signature string) error
func (*MemoryDataStore) DeleteAccessTokensByRequestID ¶ added in v0.5.0
func (m *MemoryDataStore) DeleteAccessTokensByRequestID(requestID string) error
func (*MemoryDataStore) DeleteAccount ¶ added in v0.7.0
func (m *MemoryDataStore) DeleteAccount(id string) error
func (*MemoryDataStore) DeleteOIDCSession ¶ added in v0.5.0
func (m *MemoryDataStore) DeleteOIDCSession(signature string) error
func (*MemoryDataStore) DeleteOIDCStorageValue ¶ added in v0.5.0
func (m *MemoryDataStore) DeleteOIDCStorageValue(key string) error
func (*MemoryDataStore) DeletePKCE ¶ added in v0.5.0
func (m *MemoryDataStore) DeletePKCE(signature string) error
func (*MemoryDataStore) DeleteRefreshToken ¶ added in v0.5.0
func (m *MemoryDataStore) DeleteRefreshToken(signature string) error
func (*MemoryDataStore) DeleteRole ¶ added in v0.7.0
func (m *MemoryDataStore) DeleteRole(id string) error
func (*MemoryDataStore) DeleteSecretParams ¶ added in v0.6.5
func (m *MemoryDataStore) DeleteSecretParams(id string) error
func (*MemoryDataStore) DoesPadExist ¶
func (m *MemoryDataStore) DoesPadExist(padID string) (*bool, error)
func (*MemoryDataStore) DoesSheetExist ¶ added in v0.6.5
func (m *MemoryDataStore) DoesSheetExist(padId string) (*bool, error)
func (*MemoryDataStore) GetAPIKeyByHash ¶ added in v0.7.0
func (m *MemoryDataStore) GetAPIKeyByHash(hash string) (*APIKey, error)
func (*MemoryDataStore) GetAccessToken ¶ added in v0.5.0
func (m *MemoryDataStore) GetAccessToken(signature string) (*OAuthTokenRow, error)
func (*MemoryDataStore) GetAccount ¶ added in v0.7.0
func (m *MemoryDataStore) GetAccount(id string) (*Account, error)
func (*MemoryDataStore) GetAccountByUsername ¶ added in v0.7.0
func (m *MemoryDataStore) GetAccountByUsername(u string) (*Account, error)
func (*MemoryDataStore) GetAuthCode ¶ added in v0.5.0
func (m *MemoryDataStore) GetAuthCode(signature string) (*OAuthTokenRow, error)
func (*MemoryDataStore) GetAuthor ¶
func (m *MemoryDataStore) GetAuthor(authorId string) (*db.AuthorDB, error)
func (*MemoryDataStore) GetAuthorByMapper ¶ added in v0.7.0
func (m *MemoryDataStore) GetAuthorByMapper(mapper string) (string, error)
func (*MemoryDataStore) GetAuthorByToken ¶
func (m *MemoryDataStore) GetAuthorByToken(token string) (*string, error)
func (*MemoryDataStore) GetAuthorIdsOfPadChats ¶ added in v0.0.4
func (m *MemoryDataStore) GetAuthorIdsOfPadChats(id string) (*[]string, error)
func (*MemoryDataStore) GetAuthorRow ¶ added in v0.7.0
func (m *MemoryDataStore) GetAuthorRow(authorId string) (*AuthorRow, error)
func (*MemoryDataStore) GetAuthors ¶ added in v0.0.4
func (m *MemoryDataStore) GetAuthors(ids []string) (*[]db.AuthorDB, error)
func (*MemoryDataStore) GetChatsOfPad ¶ added in v0.0.2
func (m *MemoryDataStore) GetChatsOfPad( padId string, start int, end int, ) (*[]db.ChatMessageDBWithDisplayName, error)
func (*MemoryDataStore) GetGroup ¶
func (m *MemoryDataStore) GetGroup(groupId string) (*string, error)
func (*MemoryDataStore) GetGroups ¶ added in v0.6.3
func (m *MemoryDataStore) GetGroups() (*[]string, error)
func (*MemoryDataStore) GetInstanceFlag ¶ added in v0.7.0
func (m *MemoryDataStore) GetInstanceFlag(name string) (*string, error)
func (*MemoryDataStore) GetOIDCSession ¶ added in v0.5.0
func (m *MemoryDataStore) GetOIDCSession(signature string) (*OAuthTokenRow, error)
func (*MemoryDataStore) GetOIDCStorageValue ¶ added in v0.5.0
func (m *MemoryDataStore) GetOIDCStorageValue(key string) (*string, error)
func (*MemoryDataStore) GetPKCE ¶ added in v0.5.0
func (m *MemoryDataStore) GetPKCE(signature string) (*OAuthTokenRow, error)
func (*MemoryDataStore) GetPadByReadOnlyId ¶ added in v0.0.4
func (m *MemoryDataStore) GetPadByReadOnlyId(readonlyId string) (*string, error)
func (*MemoryDataStore) GetPadIds ¶
func (m *MemoryDataStore) GetPadIds() (*[]string, error)
func (*MemoryDataStore) GetPadIdsOfAuthor ¶ added in v0.0.4
func (m *MemoryDataStore) GetPadIdsOfAuthor(authorId string) (*[]string, error)
func (*MemoryDataStore) GetPadVersion ¶ added in v0.7.0
func (m *MemoryDataStore) GetPadVersion(padID string) (*PadVersion, error)
func (*MemoryDataStore) GetReadOnly2Pad
deprecated
func (m *MemoryDataStore) GetReadOnly2Pad(id string) (*string, error)
Deprecated: Use GetPadByReadOnlyId instead
func (*MemoryDataStore) GetReadonlyPad ¶
func (m *MemoryDataStore) GetReadonlyPad(padId string) (*string, error)
func (*MemoryDataStore) GetRefreshToken ¶ added in v0.5.0
func (m *MemoryDataStore) GetRefreshToken(signature string) (*OAuthRefreshTokenRow, error)
func (*MemoryDataStore) GetRevision ¶
func (m *MemoryDataStore) GetRevision(padId string, rev int) (*db.PadSingleRevision, error)
func (*MemoryDataStore) GetRevisionDeltas ¶ added in v0.7.0
func (m *MemoryDataStore) GetRevisionDeltas(padID string, fromRev, toRev int) ([]RevisionDelta, error)
func (*MemoryDataStore) GetRevisionPool ¶ added in v0.7.0
func (*MemoryDataStore) GetRevisions ¶ added in v0.0.2
func (m *MemoryDataStore) GetRevisions(padId string, startRev int, endRev int) (*[]db.PadSingleRevision, error)
func (*MemoryDataStore) GetRole ¶ added in v0.7.0
func (m *MemoryDataStore) GetRole(id string) (*Role, error)
func (*MemoryDataStore) GetServerVersion ¶ added in v0.0.5
func (m *MemoryDataStore) GetServerVersion() (*db.ServerVersion, error)
func (*MemoryDataStore) GetSessionById ¶
func (m *MemoryDataStore) GetSessionById(sessionID string) (*session2.Session, error)
func (*MemoryDataStore) GetSheet ¶ added in v0.6.5
func (m *MemoryDataStore) GetSheet(padId string) (*db.SheetDB, error)
func (*MemoryDataStore) GetSheetOpInfo ¶ added in v0.7.0
func (*MemoryDataStore) GetSheetOps ¶ added in v0.6.5
func (*MemoryDataStore) GetSheetVersion ¶ added in v0.7.0
func (m *MemoryDataStore) GetSheetVersion(padId string) (*SheetVersion, error)
func (*MemoryDataStore) GetToken ¶ added in v0.7.0
func (m *MemoryDataStore) GetToken(id string) (*Token, error)
func (*MemoryDataStore) GetTokenByHash ¶ added in v0.7.0
func (m *MemoryDataStore) GetTokenByHash(hash string) (*Token, error)
func (*MemoryDataStore) HasAuditEntry ¶ added in v0.7.0
func (m *MemoryDataStore) HasAuditEntry(id string) (bool, error)
func (*MemoryDataStore) HeartbeatClusterNode ¶ added in v0.7.0
func (*MemoryDataStore) InvalidateAuthCode ¶ added in v0.5.0
func (m *MemoryDataStore) InvalidateAuthCode(signature string) error
func (*MemoryDataStore) ListAPIKeys ¶ added in v0.7.0
func (m *MemoryDataStore) ListAPIKeys() ([]APIKey, error)
func (*MemoryDataStore) ListAccounts ¶ added in v0.7.0
func (m *MemoryDataStore) ListAccounts() ([]Account, error)
func (*MemoryDataStore) ListAudit ¶ added in v0.7.0
func (m *MemoryDataStore) ListAudit(limit int) ([]AuditEntry, error)
func (*MemoryDataStore) ListClusterNodes ¶ added in v0.7.0
func (m *MemoryDataStore) ListClusterNodes(aliveSince time.Time) ([]ClusterNode, error)
func (*MemoryDataStore) ListPadIDs ¶ added in v0.7.0
func (m *MemoryDataStore) ListPadIDs(l PadListing) ([]string, error)
func (*MemoryDataStore) ListRoleAssignments ¶ added in v0.7.0
func (m *MemoryDataStore) ListRoleAssignments(accountID string) ([]RoleAssignment, error)
func (*MemoryDataStore) ListRoles ¶ added in v0.7.0
func (m *MemoryDataStore) ListRoles() ([]Role, error)
func (*MemoryDataStore) ListSecretParams ¶ added in v0.6.5
func (m *MemoryDataStore) ListSecretParams(prefix string) (map[string]string, error)
func (*MemoryDataStore) ListTokens ¶ added in v0.7.0
func (m *MemoryDataStore) ListTokens(accountID string) ([]Token, error)
func (*MemoryDataStore) LockPadsExclusive ¶ added in v0.7.0
func (m *MemoryDataStore) LockPadsExclusive(padIDs []string) (func(), error)
LockPadsExclusive locks within this process: an in-memory store belongs to one process.
func (*MemoryDataStore) MarkAuthorErased ¶ added in v0.7.0
func (m *MemoryDataStore) MarkAuthorErased(authorId string, at int64) error
func (*MemoryDataStore) Ping ¶ added in v0.0.5
func (m *MemoryDataStore) Ping() error
func (*MemoryDataStore) PruneClusterNodes ¶ added in v0.7.0
func (m *MemoryDataStore) PruneClusterNodes(before time.Time) error
func (*MemoryDataStore) QueryPad ¶ added in v0.0.2
func (m *MemoryDataStore) QueryPad( offset int, limit int, sortBy string, ascending bool, pattern string, ) (*db.PadDBSearchResult, error)
func (*MemoryDataStore) RemoveChat ¶
func (m *MemoryDataStore) RemoveChat(padId string) error
func (*MemoryDataStore) RemoveClusterNode ¶ added in v0.7.0
func (m *MemoryDataStore) RemoveClusterNode(id string) error
func (*MemoryDataStore) RemoveGroup ¶ added in v0.0.2
func (m *MemoryDataStore) RemoveGroup(groupId string) error
func (*MemoryDataStore) RemoveMapperOfAuthor ¶ added in v0.7.0
func (m *MemoryDataStore) RemoveMapperOfAuthor(authorId string) (bool, error)
func (*MemoryDataStore) RemovePad ¶
func (m *MemoryDataStore) RemovePad(padID string) error
func (*MemoryDataStore) RemovePad2ReadOnly
deprecated
func (m *MemoryDataStore) RemovePad2ReadOnly(id string) error
Deprecated: Handled by RemovePad
func (*MemoryDataStore) RemoveReadOnly2Pad
deprecated
func (m *MemoryDataStore) RemoveReadOnly2Pad(id string) error
Deprecated: Handled by RemovePad
func (*MemoryDataStore) RemoveRevisionsOfPad ¶
func (m *MemoryDataStore) RemoveRevisionsOfPad(padId string) error
func (*MemoryDataStore) RemoveRoleAssignment ¶ added in v0.7.0
func (m *MemoryDataStore) RemoveRoleAssignment(accountID, roleID, padPattern string) error
func (*MemoryDataStore) RemoveSessionById ¶
func (m *MemoryDataStore) RemoveSessionById(sessionID string) error
func (*MemoryDataStore) RemoveSheet ¶ added in v0.6.5
func (m *MemoryDataStore) RemoveSheet(padId string) error
func (*MemoryDataStore) RemoveSheetOps ¶ added in v0.6.5
func (m *MemoryDataStore) RemoveSheetOps(padId string) error
func (*MemoryDataStore) RemoveTokenOfAuthor ¶ added in v0.6.3
func (m *MemoryDataStore) RemoveTokenOfAuthor(authorId string) error
func (*MemoryDataStore) RemoveTokenTransfersBefore ¶ added in v0.7.0
func (m *MemoryDataStore) RemoveTokenTransfersBefore(before time.Time) error
func (*MemoryDataStore) ReplaceRevisions ¶ added in v0.7.0
func (m *MemoryDataStore) ReplaceRevisions(padId string, pad db.PadDB, revisions []db.PadSingleRevision) error
func (*MemoryDataStore) ResetSheet ¶ added in v0.7.0
func (m *MemoryDataStore) ResetSheet(padId string, snapshot string) error
func (*MemoryDataStore) RevokeRefreshToken ¶ added in v0.5.0
func (m *MemoryDataStore) RevokeRefreshToken(signature string) error
func (*MemoryDataStore) RevokeRefreshTokensByRequestID ¶ added in v0.5.0
func (m *MemoryDataStore) RevokeRefreshTokensByRequestID(requestID string) error
func (*MemoryDataStore) SaveAuthor ¶
func (m *MemoryDataStore) SaveAuthor(author db.AuthorDB) error
func (*MemoryDataStore) SaveAuthorColor ¶
func (m *MemoryDataStore) SaveAuthorColor(authorId string, authorColor string) error
func (*MemoryDataStore) SaveAuthorName ¶
func (m *MemoryDataStore) SaveAuthorName(authorId string, authorName string) error
func (*MemoryDataStore) SaveChatHeadOfPad ¶ added in v0.0.2
func (m *MemoryDataStore) SaveChatHeadOfPad(padId string, head int) error
func (*MemoryDataStore) SaveChatMessage ¶ added in v0.0.2
func (*MemoryDataStore) SaveGroup ¶ added in v0.0.2
func (m *MemoryDataStore) SaveGroup(groupId string) error
func (*MemoryDataStore) SaveRevision ¶
func (*MemoryDataStore) SaveSecretParams ¶ added in v0.6.5
func (m *MemoryDataStore) SaveSecretParams(id string, prefix string, payload string) error
func (*MemoryDataStore) SaveServerVersion ¶ added in v0.0.5
func (m *MemoryDataStore) SaveServerVersion(version string) error
func (*MemoryDataStore) SaveSheet ¶ added in v0.6.5
func (m *MemoryDataStore) SaveSheet(padId string, head int, snapshot string) error
func (*MemoryDataStore) SaveSheetOp ¶ added in v0.6.5
func (*MemoryDataStore) SearchAuthors ¶ added in v0.7.0
func (m *MemoryDataStore) SearchAuthors(s AuthorSearch) ([]AuthorRow, error)
func (*MemoryDataStore) SetAPIKeyDisabled ¶ added in v0.7.0
func (m *MemoryDataStore) SetAPIKeyDisabled(id string, disabled bool) error
func (*MemoryDataStore) SetAuthorByToken ¶
func (m *MemoryDataStore) SetAuthorByToken(token string, authorId string) error
func (*MemoryDataStore) SetAuthorMapper ¶ added in v0.7.0
func (m *MemoryDataStore) SetAuthorMapper(authorId, mapper string) error
func (*MemoryDataStore) SetInstanceFlag ¶ added in v0.7.0
func (m *MemoryDataStore) SetInstanceFlag(name, value string) (bool, error)
func (*MemoryDataStore) SetOIDCStorageValue ¶ added in v0.5.0
func (m *MemoryDataStore) SetOIDCStorageValue(key string, payload string) error
func (*MemoryDataStore) SetPadPublicStatus ¶ added in v0.7.0
func (m *MemoryDataStore) SetPadPublicStatus(padID string, public bool) error
func (*MemoryDataStore) SetPadSavedRevisions ¶ added in v0.7.0
func (m *MemoryDataStore) SetPadSavedRevisions(padID string, saved []db.SavedRevision) error
func (*MemoryDataStore) SetPadSettings ¶ added in v0.7.0
func (m *MemoryDataStore) SetPadSettings(padID string, settings string) error
func (*MemoryDataStore) SetReadOnlyId ¶ added in v0.0.4
func (m *MemoryDataStore) SetReadOnlyId(padId string, readonlyId string) error
func (*MemoryDataStore) SetSessionById ¶
func (m *MemoryDataStore) SetSessionById(sessionID string, session session2.Session) error
func (*MemoryDataStore) TakeTokenTransfer ¶ added in v0.7.0
func (m *MemoryDataStore) TakeTokenTransfer(id string) (*TokenTransfer, error)
func (*MemoryDataStore) TouchAPIKey ¶ added in v0.7.0
func (m *MemoryDataStore) TouchAPIKey(id string, at time.Time) error
func (*MemoryDataStore) TouchAuthor ¶ added in v0.7.0
func (m *MemoryDataStore) TouchAuthor(authorId string, at int64) error
func (*MemoryDataStore) TouchLogin ¶ added in v0.7.0
func (m *MemoryDataStore) TouchLogin(id string, at time.Time) error
func (*MemoryDataStore) TouchToken ¶ added in v0.7.0
func (*MemoryDataStore) TryLeadership ¶ added in v0.7.0
func (m *MemoryDataStore) TryLeadership(name string) (Leadership, bool, error)
func (*MemoryDataStore) UpdateAccount ¶ added in v0.7.0
func (m *MemoryDataStore) UpdateAccount(a Account) error
func (*MemoryDataStore) UpdatePadHead ¶ added in v0.7.0
func (*MemoryDataStore) UpdatePadHeadText ¶ added in v0.7.0
func (*MemoryDataStore) UpdateRole ¶ added in v0.7.0
func (m *MemoryDataStore) UpdateRole(r Role) error
func (*MemoryDataStore) UpdateToken ¶ added in v0.7.0
func (m *MemoryDataStore) UpdateToken(t Token) error
type MySQLOptions ¶ added in v0.0.2
type MysqlDB ¶ added in v0.0.2
type MysqlDB struct {
// contains filtered or unexported fields
}
func NewMySQLDB ¶ added in v0.0.2
func NewMySQLDB(options MySQLOptions) (*MysqlDB, error)
func (MysqlDB) AddOIDCStorageValue ¶ added in v0.7.0
func (MysqlDB) AddRoleAssignment ¶ added in v0.7.0
func (d MysqlDB) AddRoleAssignment(a RoleAssignment) error
func (MysqlDB) AppendAudit ¶ added in v0.7.0
func (d MysqlDB) AppendAudit(e AuditEntry) error
func (MysqlDB) ClaimReadOnlyId ¶ added in v0.7.0
func (MysqlDB) ClearChatAuthorship ¶ added in v0.6.3
func (MysqlDB) ConsumeAuthCode ¶ added in v0.7.0
func (MysqlDB) CountChatMessagesOfAuthor ¶ added in v0.7.0
func (MysqlDB) CreateAPIKey ¶ added in v0.7.0
func (MysqlDB) CreateAccessToken ¶ added in v0.5.0
func (MysqlDB) CreateAccount ¶ added in v0.7.0
func (MysqlDB) CreateAuthCode ¶ added in v0.5.0
func (MysqlDB) CreateOIDCSession ¶ added in v0.5.0
func (MysqlDB) CreatePKCE ¶ added in v0.5.0
func (MysqlDB) CreateRefreshToken ¶ added in v0.5.0
func (MysqlDB) CreateRole ¶ added in v0.7.0
func (MysqlDB) CreateToken ¶ added in v0.7.0
func (MysqlDB) CreateTokenTransfer ¶ added in v0.7.0
func (d MysqlDB) CreateTokenTransfer(t TokenTransfer) error
func (MysqlDB) DeleteAPIKey ¶ added in v0.7.0
func (MysqlDB) DeleteAccessToken ¶ added in v0.5.0
func (MysqlDB) DeleteAccessTokensByRequestID ¶ added in v0.5.0
func (MysqlDB) DeleteAccount ¶ added in v0.7.0
func (MysqlDB) DeleteOIDCSession ¶ added in v0.5.0
func (MysqlDB) DeleteOIDCStorageValue ¶ added in v0.5.0
func (MysqlDB) DeletePKCE ¶ added in v0.5.0
func (MysqlDB) DeleteRefreshToken ¶ added in v0.5.0
func (MysqlDB) DeleteRole ¶ added in v0.7.0
func (MysqlDB) DeleteSecretParams ¶ added in v0.6.5
func (MysqlDB) DoesPadExist ¶ added in v0.0.2
func (MysqlDB) DoesSheetExist ¶ added in v0.6.5
func (MysqlDB) GetAPIKeyByHash ¶ added in v0.7.0
func (MysqlDB) GetAccessToken ¶ added in v0.5.0
func (d MysqlDB) GetAccessToken(signature string) (*OAuthTokenRow, error)
func (MysqlDB) GetAccount ¶ added in v0.7.0
func (MysqlDB) GetAccountByUsername ¶ added in v0.7.0
func (MysqlDB) GetAuthCode ¶ added in v0.5.0
func (d MysqlDB) GetAuthCode(signature string) (*OAuthTokenRow, error)
func (MysqlDB) GetAuthorByMapper ¶ added in v0.7.0
func (MysqlDB) GetAuthorByToken ¶ added in v0.0.2
func (MysqlDB) GetAuthorIdsOfPadChats ¶ added in v0.0.4
func (MysqlDB) GetAuthorRow ¶ added in v0.7.0
func (MysqlDB) GetAuthors ¶ added in v0.0.4
func (MysqlDB) GetChatsOfPad ¶ added in v0.0.2
func (MysqlDB) GetInstanceFlag ¶ added in v0.7.0
func (MysqlDB) GetOIDCSession ¶ added in v0.5.0
func (d MysqlDB) GetOIDCSession(signature string) (*OAuthTokenRow, error)
func (MysqlDB) GetOIDCStorageValue ¶ added in v0.5.0
func (MysqlDB) GetPKCE ¶ added in v0.5.0
func (d MysqlDB) GetPKCE(signature string) (*OAuthTokenRow, error)
func (MysqlDB) GetPadByReadOnlyId ¶ added in v0.0.4
func (MysqlDB) GetPadIdsOfAuthor ¶ added in v0.0.4
func (MysqlDB) GetPadVersion ¶ added in v0.7.0
func (d MysqlDB) GetPadVersion(padID string) (*PadVersion, error)
func (MysqlDB) GetReadonlyPad ¶ added in v0.0.2
func (MysqlDB) GetRefreshToken ¶ added in v0.5.0
func (d MysqlDB) GetRefreshToken(signature string) (*OAuthRefreshTokenRow, error)
func (MysqlDB) GetRevision ¶ added in v0.0.2
func (MysqlDB) GetRevisionDeltas ¶ added in v0.7.0
func (d MysqlDB) GetRevisionDeltas(padID string, fromRev, toRev int) ([]RevisionDelta, error)
func (MysqlDB) GetRevisionPool ¶ added in v0.7.0
func (MysqlDB) GetRevisions ¶ added in v0.0.2
func (MysqlDB) GetServerVersion ¶ added in v0.0.5
func (d MysqlDB) GetServerVersion() (*db.ServerVersion, error)
func (MysqlDB) GetSessionById ¶ added in v0.0.2
func (MysqlDB) GetSheetOpInfo ¶ added in v0.7.0
func (MysqlDB) GetSheetOps ¶ added in v0.6.5
func (MysqlDB) GetSheetVersion ¶ added in v0.7.0
func (d MysqlDB) GetSheetVersion(padId string) (*SheetVersion, error)
func (MysqlDB) GetTokenByHash ¶ added in v0.7.0
func (MysqlDB) HasAuditEntry ¶ added in v0.7.0
func (MysqlDB) HeartbeatClusterNode ¶ added in v0.7.0
func (MysqlDB) InvalidateAuthCode ¶ added in v0.5.0
func (MysqlDB) ListAPIKeys ¶ added in v0.7.0
func (MysqlDB) ListAccounts ¶ added in v0.7.0
func (MysqlDB) ListAudit ¶ added in v0.7.0
func (d MysqlDB) ListAudit(limit int) ([]AuditEntry, error)
func (MysqlDB) ListClusterNodes ¶ added in v0.7.0
func (d MysqlDB) ListClusterNodes(aliveSince time.Time) ([]ClusterNode, error)
func (MysqlDB) ListPadIDs ¶ added in v0.7.0
func (d MysqlDB) ListPadIDs(l PadListing) ([]string, error)
func (MysqlDB) ListRoleAssignments ¶ added in v0.7.0
func (d MysqlDB) ListRoleAssignments(accountID string) ([]RoleAssignment, error)
func (MysqlDB) ListSecretParams ¶ added in v0.6.5
func (MysqlDB) ListTokens ¶ added in v0.7.0
func (MysqlDB) LockPadsExclusive ¶ added in v0.7.0
func (MysqlDB) MarkAuthorErased ¶ added in v0.7.0
func (MysqlDB) PruneClusterNodes ¶ added in v0.7.0
func (MysqlDB) RemoveChat ¶ added in v0.0.2
func (MysqlDB) RemoveClusterNode ¶ added in v0.7.0
func (MysqlDB) RemoveGroup ¶ added in v0.0.2
func (MysqlDB) RemoveMapperOfAuthor ¶ added in v0.7.0
func (MysqlDB) RemoveRevisionsOfPad ¶ added in v0.0.2
func (MysqlDB) RemoveRoleAssignment ¶ added in v0.7.0
func (MysqlDB) RemoveSessionById ¶ added in v0.0.2
func (MysqlDB) RemoveSheet ¶ added in v0.6.5
func (MysqlDB) RemoveSheetOps ¶ added in v0.6.5
func (MysqlDB) RemoveTokenOfAuthor ¶ added in v0.6.3
func (MysqlDB) RemoveTokenTransfersBefore ¶ added in v0.7.0
func (MysqlDB) ReplaceRevisions ¶ added in v0.7.0
func (MysqlDB) ResetSheet ¶ added in v0.7.0
func (MysqlDB) RevokeRefreshToken ¶ added in v0.5.0
func (MysqlDB) RevokeRefreshTokensByRequestID ¶ added in v0.5.0
func (MysqlDB) SaveAuthorColor ¶ added in v0.0.2
func (MysqlDB) SaveAuthorName ¶ added in v0.0.2
func (MysqlDB) SaveChatHeadOfPad ¶ added in v0.0.2
func (MysqlDB) SaveChatMessage ¶ added in v0.0.2
func (MysqlDB) SaveRevision ¶ added in v0.0.2
func (MysqlDB) SaveSecretParams ¶ added in v0.6.5
func (MysqlDB) SaveServerVersion ¶ added in v0.0.5
func (MysqlDB) SaveSheetOp ¶ added in v0.6.5
func (MysqlDB) SearchAuthors ¶ added in v0.7.0
func (d MysqlDB) SearchAuthors(s AuthorSearch) ([]AuthorRow, error)
func (MysqlDB) SetAPIKeyDisabled ¶ added in v0.7.0
func (MysqlDB) SetAuthorByToken ¶ added in v0.0.2
func (MysqlDB) SetAuthorMapper ¶ added in v0.7.0
func (MysqlDB) SetInstanceFlag ¶ added in v0.7.0
func (MysqlDB) SetOIDCStorageValue ¶ added in v0.5.0
func (MysqlDB) SetPadPublicStatus ¶ added in v0.7.0
func (MysqlDB) SetPadSavedRevisions ¶ added in v0.7.0
func (d MysqlDB) SetPadSavedRevisions(padID string, saved []db.SavedRevision) error
func (MysqlDB) SetPadSettings ¶ added in v0.7.0
func (MysqlDB) SetReadOnlyId ¶ added in v0.0.4
func (MysqlDB) SetSessionById ¶ added in v0.0.2
func (MysqlDB) TakeTokenTransfer ¶ added in v0.7.0
func (d MysqlDB) TakeTokenTransfer(id string) (*TokenTransfer, error)
func (MysqlDB) TouchAPIKey ¶ added in v0.7.0
func (MysqlDB) TouchAuthor ¶ added in v0.7.0
func (MysqlDB) TouchLogin ¶ added in v0.7.0
func (MysqlDB) TouchToken ¶ added in v0.7.0
func (MysqlDB) TryLeadership ¶ added in v0.7.0
func (d MysqlDB) TryLeadership(name string) (Leadership, bool, error)
func (MysqlDB) UpdateAccount ¶ added in v0.7.0
func (MysqlDB) UpdatePadHead ¶ added in v0.7.0
func (MysqlDB) UpdatePadHeadText ¶ added in v0.7.0
func (MysqlDB) UpdateRole ¶ added in v0.7.0
func (MysqlDB) UpdateToken ¶ added in v0.7.0
type OAuthRefreshTokenRow ¶ added in v0.5.0
type OAuthRefreshTokenRow struct {
OAuthTokenRow
AccessTokenSignature string
}
type OAuthTokenRow ¶ added in v0.5.0
type OIDCMethods ¶ added in v0.5.0
type OIDCMethods interface {
// Existing key-value methods (keep for signing key storage)
GetOIDCStorageValue(key string) (*string, error)
SetOIDCStorageValue(key string, payload string) error
// AddOIDCStorageValue stores payload under key only if the key is
// unused, and returns the stored payload: the first writer's, when
// several write at once.
AddOIDCStorageValue(key string, payload string) (string, error)
DeleteOIDCStorageValue(key string) error
// Access tokens
CreateAccessToken(signature, clientID, requestID, scopes, grantedScopes, formData, sessionData string, requestedAt, expiresAt time.Time) error
GetAccessToken(signature string) (*OAuthTokenRow, error)
DeleteAccessToken(signature string) error
DeleteAccessTokensByRequestID(requestID string) error
// Refresh tokens
CreateRefreshToken(signature, clientID, requestID, scopes, grantedScopes, formData, sessionData string, active bool, accessTokenSignature string, requestedAt, expiresAt time.Time) error
GetRefreshToken(signature string) (*OAuthRefreshTokenRow, error)
DeleteRefreshToken(signature string) error
RevokeRefreshToken(signature string) error
RevokeRefreshTokensByRequestID(requestID string) error
// Auth codes
CreateAuthCode(signature, clientID, requestID, scopes, grantedScopes, formData, sessionData string, requestedAt, expiresAt time.Time) error
GetAuthCode(signature string) (*OAuthTokenRow, error)
InvalidateAuthCode(signature string) error
// ConsumeAuthCode deactivates an active code; true only for the one
// call that did, so a code is used once also when callers race.
ConsumeAuthCode(signature string) (bool, error)
// PKCE
CreatePKCE(signature, clientID, requestID, scopes, grantedScopes, formData, sessionData string, requestedAt, expiresAt time.Time) error
GetPKCE(signature string) (*OAuthTokenRow, error)
DeletePKCE(signature string) error
// OIDC Sessions
CreateOIDCSession(signature, clientID, requestID, scopes, grantedScopes, formData, sessionData string, requestedAt, expiresAt time.Time) error
GetOIDCSession(signature string) (*OAuthTokenRow, error)
DeleteOIDCSession(signature string) error
}
type PadHeadMethods ¶ added in v0.7.0
type PadHeadMethods interface {
// UpdatePadHead records a new head revision and pool in the pad row.
// It never moves the head back: another instance may have recorded a
// newer one meanwhile.
UpdatePadHead(padID string, head int, pool db.RevPool) error
// UpdatePadHeadText is UpdatePadHead that also stores the text of a key
// revision as the row's cached text.
UpdatePadHeadText(padID string, head int, pool db.RevPool, text db.AText) error
// SetPadPublicStatus changes only the public status.
SetPadPublicStatus(padID string, public bool) error
// SetPadSettings replaces only the pad-wide settings (JSON).
SetPadSettings(padID string, settings string) error
// SetPadSavedRevisions replaces only the saved revisions. Callers hold
// the pad lock and have just reloaded them, so no change is lost.
SetPadSavedRevisions(padID string, saved []db.SavedRevision) error
// ClaimReadOnlyId stores candidate as the pad's read-only id unless it
// has one already, and returns the stored id. Instances asking at the
// same time thus all get the same id.
ClaimReadOnlyId(padID string, candidate string) (string, error)
}
PadHeadMethods keep the pad row current. They change only the columns they name: the pad row is shared by every instance, and rewriting all of it from one instance's copy would undo what another instance changed.
type PadListing ¶ added in v0.7.0
type PadListing struct {
// After: only ids after this one (the last id of the page before).
After string
// Prefix: only ids that start with it.
Prefix string
// Contains: only ids that contain it, case ignored.
Contains string
// DocumentType: only pads of this type ("text", "sheet"); "" for all.
DocumentType string
// Limit: at most this many ids (1 to 1000).
Limit int
}
PadListing narrows ListPadIDs.
type PadListingMethods ¶ added in v0.7.0
type PadListingMethods interface {
// ListPadIDs returns pad ids in order, at most l.Limit of them.
ListPadIDs(l PadListing) ([]string, error)
}
PadListingMethods list pad ids page by page, in the database, so a caller never reads every pad of a large instance at once.
type PadMeta ¶ added in v0.7.0
type PadMeta struct {
SavedRevisions []db.SavedRevision
PublicStatus bool
ReadOnlyId *string
// Settings is the stored pad-wide settings JSON, "" for none.
Settings string
}
PadMeta is the part of the pad row that is not derived from revisions.
type PadMethods ¶
type PadMethods interface {
DoesPadExist(padID string) (*bool, error)
RemovePad(padID string) error
CreatePad(padID string, padDB db.PadDB) error
GetPadIds() (*[]string, error)
SaveRevision(padId string, rev int, changeset string, text db.AText, pool db.RevPool, authorId *string, timestamp int64) error
GetRevision(padId string, rev int) (*db.PadSingleRevision, error)
RemoveRevisionsOfPad(padId string) error
// ReplaceRevisions swaps the pad's whole revision history and its row
// in one transaction: afterwards the pad has exactly revisions (numbered
// from 0) and the row pad; on any error nothing changed. Used by
// revision compaction, which must never leave a pad half rewritten.
ReplaceRevisions(padId string, pad db.PadDB, revisions []db.PadSingleRevision) error
GetRevisions(padId string, startRev int, endRev int) (*[]db.PadSingleRevision, error)
GetPad(padID string) (*db.PadDB, error)
GetReadonlyPad(padId string) (*string, error)
SetReadOnlyId(padId string, readOnlyId string) error
GetPadByReadOnlyId(id string) (*string, error)
SaveChatHeadOfPad(padId string, head int) error
QueryPad(offset int, limit int, sortBy string, ascending bool, pattern string) (*db.PadDBSearchResult, error)
}
type PadVersion ¶ added in v0.7.0
type PadVersion struct {
Exists bool
// Rev is the highest stored revision, -1 if there is none.
Rev int
// ChatHead is the highest stored chat message number, -1 if none.
ChatHead int
// Meta is the metadata in the pad row; nil if the pad does not exist.
// It is read with the version so a writer holding the pad lock always
// works on the current metadata, even if another instance changed it.
Meta *PadMeta
}
PadVersion is what a pad's authoritative state in the database is at.
type PostgresDB ¶ added in v0.0.2
type PostgresDB struct {
// contains filtered or unexported fields
}
func NewPostgresDB ¶ added in v0.0.2
func NewPostgresDB(options PostgresOptions) (*PostgresDB, error)
func (PostgresDB) AddOIDCStorageValue ¶ added in v0.7.0
func (d PostgresDB) AddOIDCStorageValue(key string, payload string) (string, error)
func (PostgresDB) AddRoleAssignment ¶ added in v0.7.0
func (d PostgresDB) AddRoleAssignment(a RoleAssignment) error
func (PostgresDB) AppendAudit ¶ added in v0.7.0
func (d PostgresDB) AppendAudit(e AuditEntry) error
func (PostgresDB) ClaimReadOnlyId ¶ added in v0.7.0
func (d PostgresDB) ClaimReadOnlyId(padID string, candidate string) (string, error)
func (PostgresDB) ClearChatAuthorship ¶ added in v0.6.3
func (d PostgresDB) ClearChatAuthorship(authorId string) error
func (PostgresDB) Close ¶ added in v0.0.2
func (d PostgresDB) Close() error
func (PostgresDB) ConsumeAuthCode ¶ added in v0.7.0
func (d PostgresDB) ConsumeAuthCode(signature string) (bool, error)
func (PostgresDB) CountChatMessagesOfAuthor ¶ added in v0.7.0
func (d PostgresDB) CountChatMessagesOfAuthor(id string) (int, error)
func (PostgresDB) CreateAPIKey ¶ added in v0.7.0
func (d PostgresDB) CreateAPIKey(k APIKey) error
func (PostgresDB) CreateAccessToken ¶ added in v0.5.0
func (d PostgresDB) CreateAccessToken(signature, clientID, requestID, scopes, grantedScopes, formData, sessionData string, requestedAt, expiresAt time.Time) error
func (PostgresDB) CreateAccount ¶ added in v0.7.0
func (d PostgresDB) CreateAccount(a Account) error
func (PostgresDB) CreateAuthCode ¶ added in v0.5.0
func (d PostgresDB) CreateAuthCode(signature, clientID, requestID, scopes, grantedScopes, formData, sessionData string, requestedAt, expiresAt time.Time) error
func (PostgresDB) CreateOIDCSession ¶ added in v0.5.0
func (d PostgresDB) CreateOIDCSession(signature, clientID, requestID, scopes, grantedScopes, formData, sessionData string, requestedAt, expiresAt time.Time) error
func (PostgresDB) CreatePKCE ¶ added in v0.5.0
func (d PostgresDB) CreatePKCE(signature, clientID, requestID, scopes, grantedScopes, formData, sessionData string, requestedAt, expiresAt time.Time) error
func (PostgresDB) CreatePad ¶ added in v0.0.2
func (d PostgresDB) CreatePad(padID string, padDB db.PadDB) error
func (PostgresDB) CreateRefreshToken ¶ added in v0.5.0
func (PostgresDB) CreateRole ¶ added in v0.7.0
func (d PostgresDB) CreateRole(r Role) error
func (PostgresDB) CreateToken ¶ added in v0.7.0
func (d PostgresDB) CreateToken(t Token) error
func (PostgresDB) CreateTokenTransfer ¶ added in v0.7.0
func (d PostgresDB) CreateTokenTransfer(t TokenTransfer) error
func (PostgresDB) DeleteAPIKey ¶ added in v0.7.0
func (d PostgresDB) DeleteAPIKey(id string) error
func (PostgresDB) DeleteAccessToken ¶ added in v0.5.0
func (d PostgresDB) DeleteAccessToken(signature string) error
func (PostgresDB) DeleteAccessTokensByRequestID ¶ added in v0.5.0
func (d PostgresDB) DeleteAccessTokensByRequestID(requestID string) error
func (PostgresDB) DeleteAccount ¶ added in v0.7.0
func (d PostgresDB) DeleteAccount(id string) error
func (PostgresDB) DeleteOIDCSession ¶ added in v0.5.0
func (d PostgresDB) DeleteOIDCSession(signature string) error
func (PostgresDB) DeleteOIDCStorageValue ¶ added in v0.5.0
func (d PostgresDB) DeleteOIDCStorageValue(key string) error
func (PostgresDB) DeletePKCE ¶ added in v0.5.0
func (d PostgresDB) DeletePKCE(signature string) error
func (PostgresDB) DeleteRefreshToken ¶ added in v0.5.0
func (d PostgresDB) DeleteRefreshToken(signature string) error
func (PostgresDB) DeleteRole ¶ added in v0.7.0
func (d PostgresDB) DeleteRole(id string) error
func (PostgresDB) DeleteSecretParams ¶ added in v0.6.5
func (d PostgresDB) DeleteSecretParams(id string) error
func (PostgresDB) DoesPadExist ¶ added in v0.0.2
func (d PostgresDB) DoesPadExist(padID string) (*bool, error)
func (PostgresDB) DoesSheetExist ¶ added in v0.6.5
func (d PostgresDB) DoesSheetExist(padId string) (*bool, error)
func (PostgresDB) GetAPIKeyByHash ¶ added in v0.7.0
func (d PostgresDB) GetAPIKeyByHash(hash string) (*APIKey, error)
func (PostgresDB) GetAccessToken ¶ added in v0.5.0
func (d PostgresDB) GetAccessToken(signature string) (*OAuthTokenRow, error)
func (PostgresDB) GetAccount ¶ added in v0.7.0
func (d PostgresDB) GetAccount(id string) (*Account, error)
func (PostgresDB) GetAccountByUsername ¶ added in v0.7.0
func (d PostgresDB) GetAccountByUsername(u string) (*Account, error)
func (PostgresDB) GetAuthCode ¶ added in v0.5.0
func (d PostgresDB) GetAuthCode(signature string) (*OAuthTokenRow, error)
func (PostgresDB) GetAuthor ¶ added in v0.0.2
func (d PostgresDB) GetAuthor(authorId string) (*db.AuthorDB, error)
func (PostgresDB) GetAuthorByMapper ¶ added in v0.7.0
func (d PostgresDB) GetAuthorByMapper(m string) (string, error)
func (PostgresDB) GetAuthorByToken ¶ added in v0.0.2
func (d PostgresDB) GetAuthorByToken(token string) (*string, error)
func (PostgresDB) GetAuthorIdsOfPadChats ¶ added in v0.0.4
func (d PostgresDB) GetAuthorIdsOfPadChats(id string) (*[]string, error)
func (PostgresDB) GetAuthorRow ¶ added in v0.7.0
func (d PostgresDB) GetAuthorRow(id string) (*AuthorRow, error)
func (PostgresDB) GetAuthors ¶ added in v0.0.4
func (d PostgresDB) GetAuthors( ids []string, ) (*[]db.AuthorDB, error)
func (PostgresDB) GetChatsOfPad ¶ added in v0.0.2
func (d PostgresDB) GetChatsOfPad( padId string, start int, end int, ) (*[]db.ChatMessageDBWithDisplayName, error)
func (PostgresDB) GetGroup ¶ added in v0.0.2
func (d PostgresDB) GetGroup(groupId string) (*string, error)
func (PostgresDB) GetGroups ¶ added in v0.6.3
func (d PostgresDB) GetGroups() (*[]string, error)
func (PostgresDB) GetInstanceFlag ¶ added in v0.7.0
func (d PostgresDB) GetInstanceFlag(name string) (*string, error)
func (PostgresDB) GetOIDCSession ¶ added in v0.5.0
func (d PostgresDB) GetOIDCSession(signature string) (*OAuthTokenRow, error)
func (PostgresDB) GetOIDCStorageValue ¶ added in v0.5.0
func (d PostgresDB) GetOIDCStorageValue(key string) (*string, error)
func (PostgresDB) GetPKCE ¶ added in v0.5.0
func (d PostgresDB) GetPKCE(signature string) (*OAuthTokenRow, error)
func (PostgresDB) GetPad ¶ added in v0.0.2
func (d PostgresDB) GetPad(padID string) (*db.PadDB, error)
func (PostgresDB) GetPadByReadOnlyId ¶ added in v0.0.4
func (d PostgresDB) GetPadByReadOnlyId(readonlyId string) (*string, error)
func (PostgresDB) GetPadIds ¶ added in v0.0.2
func (d PostgresDB) GetPadIds() (*[]string, error)
func (PostgresDB) GetPadIdsOfAuthor ¶ added in v0.0.4
func (d PostgresDB) GetPadIdsOfAuthor(authorId string) (*[]string, error)
func (PostgresDB) GetPadVersion ¶ added in v0.7.0
func (d PostgresDB) GetPadVersion(padID string) (*PadVersion, error)
func (PostgresDB) GetReadonlyPad ¶ added in v0.0.2
func (d PostgresDB) GetReadonlyPad(padId string) (*string, error)
func (PostgresDB) GetRefreshToken ¶ added in v0.5.0
func (d PostgresDB) GetRefreshToken(signature string) (*OAuthRefreshTokenRow, error)
func (PostgresDB) GetRevision ¶ added in v0.0.2
func (d PostgresDB) GetRevision(padId string, rev int) (*db.PadSingleRevision, error)
func (PostgresDB) GetRevisionDeltas ¶ added in v0.7.0
func (d PostgresDB) GetRevisionDeltas(padID string, fromRev, toRev int) ([]RevisionDelta, error)
func (PostgresDB) GetRevisionPool ¶ added in v0.7.0
func (PostgresDB) GetRevisions ¶ added in v0.0.2
func (d PostgresDB) GetRevisions( padId string, startRev int, endRev int, ) (*[]db.PadSingleRevision, error)
func (PostgresDB) GetServerVersion ¶ added in v0.0.5
func (d PostgresDB) GetServerVersion() (*db.ServerVersion, error)
func (PostgresDB) GetSessionById ¶ added in v0.0.2
func (d PostgresDB) GetSessionById(sessionID string) (*session2.Session, error)
func (PostgresDB) GetSheet ¶ added in v0.6.5
func (d PostgresDB) GetSheet(padId string) (*db.SheetDB, error)
func (PostgresDB) GetSheetOpInfo ¶ added in v0.7.0
func (PostgresDB) GetSheetOps ¶ added in v0.6.5
func (PostgresDB) GetSheetVersion ¶ added in v0.7.0
func (d PostgresDB) GetSheetVersion(padId string) (*SheetVersion, error)
func (PostgresDB) GetToken ¶ added in v0.7.0
func (d PostgresDB) GetToken(id string) (*Token, error)
func (PostgresDB) GetTokenByHash ¶ added in v0.7.0
func (d PostgresDB) GetTokenByHash(h string) (*Token, error)
func (PostgresDB) HasAuditEntry ¶ added in v0.7.0
func (d PostgresDB) HasAuditEntry(id string) (bool, error)
func (PostgresDB) HeartbeatClusterNode ¶ added in v0.7.0
func (PostgresDB) InvalidateAuthCode ¶ added in v0.5.0
func (d PostgresDB) InvalidateAuthCode(signature string) error
func (PostgresDB) ListAPIKeys ¶ added in v0.7.0
func (d PostgresDB) ListAPIKeys() ([]APIKey, error)
func (PostgresDB) ListAccounts ¶ added in v0.7.0
func (d PostgresDB) ListAccounts() ([]Account, error)
func (PostgresDB) ListAudit ¶ added in v0.7.0
func (d PostgresDB) ListAudit(limit int) ([]AuditEntry, error)
func (PostgresDB) ListClusterNodes ¶ added in v0.7.0
func (d PostgresDB) ListClusterNodes(aliveSince time.Time) ([]ClusterNode, error)
func (PostgresDB) ListPadIDs ¶ added in v0.7.0
func (d PostgresDB) ListPadIDs(l PadListing) ([]string, error)
func (PostgresDB) ListRoleAssignments ¶ added in v0.7.0
func (d PostgresDB) ListRoleAssignments(accountID string) ([]RoleAssignment, error)
func (PostgresDB) ListRoles ¶ added in v0.7.0
func (d PostgresDB) ListRoles() ([]Role, error)
func (PostgresDB) ListSecretParams ¶ added in v0.6.5
func (d PostgresDB) ListSecretParams(prefix string) (map[string]string, error)
func (PostgresDB) ListTokens ¶ added in v0.7.0
func (d PostgresDB) ListTokens(accountID string) ([]Token, error)
func (PostgresDB) LockPadsExclusive ¶ added in v0.7.0
func (d PostgresDB) LockPadsExclusive(padIDs []string) (func(), error)
func (PostgresDB) MarkAuthorErased ¶ added in v0.7.0
func (d PostgresDB) MarkAuthorErased(id string, at int64) error
func (PostgresDB) Ping ¶ added in v0.0.5
func (d PostgresDB) Ping() error
func (PostgresDB) PruneClusterNodes ¶ added in v0.7.0
func (d PostgresDB) PruneClusterNodes(before time.Time) error
func (PostgresDB) QueryPad ¶ added in v0.0.2
func (d PostgresDB) QueryPad( offset int, limit int, sortBy string, ascending bool, pattern string, ) (*db.PadDBSearchResult, error)
func (PostgresDB) RemoveChat ¶ added in v0.0.2
func (d PostgresDB) RemoveChat(padId string) error
func (PostgresDB) RemoveClusterNode ¶ added in v0.7.0
func (d PostgresDB) RemoveClusterNode(id string) error
func (PostgresDB) RemoveGroup ¶ added in v0.0.2
func (d PostgresDB) RemoveGroup(groupId string) error
func (PostgresDB) RemoveMapperOfAuthor ¶ added in v0.7.0
func (d PostgresDB) RemoveMapperOfAuthor(id string) (bool, error)
func (PostgresDB) RemovePad ¶ added in v0.0.2
func (d PostgresDB) RemovePad(padID string) error
func (PostgresDB) RemoveRevisionsOfPad ¶ added in v0.0.2
func (d PostgresDB) RemoveRevisionsOfPad(padId string) error
func (PostgresDB) RemoveRoleAssignment ¶ added in v0.7.0
func (d PostgresDB) RemoveRoleAssignment(accountID, roleID, padPattern string) error
func (PostgresDB) RemoveSessionById ¶ added in v0.0.2
func (d PostgresDB) RemoveSessionById(sid string) error
func (PostgresDB) RemoveSheet ¶ added in v0.6.5
func (d PostgresDB) RemoveSheet(padId string) error
func (PostgresDB) RemoveSheetOps ¶ added in v0.6.5
func (d PostgresDB) RemoveSheetOps(padId string) error
func (PostgresDB) RemoveTokenOfAuthor ¶ added in v0.6.3
func (d PostgresDB) RemoveTokenOfAuthor(authorId string) error
func (PostgresDB) RemoveTokenTransfersBefore ¶ added in v0.7.0
func (d PostgresDB) RemoveTokenTransfersBefore(t time.Time) error
func (PostgresDB) ReplaceRevisions ¶ added in v0.7.0
func (d PostgresDB) ReplaceRevisions(padId string, pad db.PadDB, revisions []db.PadSingleRevision) error
func (PostgresDB) ResetSheet ¶ added in v0.7.0
func (d PostgresDB) ResetSheet(padId string, snapshot string) error
func (PostgresDB) RevokeRefreshToken ¶ added in v0.5.0
func (d PostgresDB) RevokeRefreshToken(signature string) error
func (PostgresDB) RevokeRefreshTokensByRequestID ¶ added in v0.5.0
func (d PostgresDB) RevokeRefreshTokensByRequestID(requestID string) error
func (PostgresDB) SaveAuthor ¶ added in v0.0.2
func (d PostgresDB) SaveAuthor(author db.AuthorDB) error
func (PostgresDB) SaveAuthorColor ¶ added in v0.0.2
func (d PostgresDB) SaveAuthorColor(authorId string, authorColor string) error
func (PostgresDB) SaveAuthorName ¶ added in v0.0.2
func (d PostgresDB) SaveAuthorName(authorId string, authorName string) error
func (PostgresDB) SaveChatHeadOfPad ¶ added in v0.0.2
func (d PostgresDB) SaveChatHeadOfPad(padId string, head int) error
func (PostgresDB) SaveChatMessage ¶ added in v0.0.2
func (PostgresDB) SaveGroup ¶ added in v0.0.2
func (d PostgresDB) SaveGroup(groupId string) error
func (PostgresDB) SaveRevision ¶ added in v0.0.2
func (PostgresDB) SaveSecretParams ¶ added in v0.6.5
func (d PostgresDB) SaveSecretParams(id string, prefix string, payload string) error
func (PostgresDB) SaveServerVersion ¶ added in v0.0.5
func (d PostgresDB) SaveServerVersion(version string) error
func (PostgresDB) SaveSheet ¶ added in v0.6.5
func (d PostgresDB) SaveSheet(padId string, head int, snapshot string) error
func (PostgresDB) SaveSheetOp ¶ added in v0.6.5
func (PostgresDB) SearchAuthors ¶ added in v0.7.0
func (d PostgresDB) SearchAuthors(s AuthorSearch) ([]AuthorRow, error)
func (PostgresDB) SetAPIKeyDisabled ¶ added in v0.7.0
func (d PostgresDB) SetAPIKeyDisabled(id string, disabled bool) error
func (PostgresDB) SetAuthorByToken ¶ added in v0.0.2
func (d PostgresDB) SetAuthorByToken(token, authorId string) error
func (PostgresDB) SetAuthorMapper ¶ added in v0.7.0
func (d PostgresDB) SetAuthorMapper(id, m string) error
func (PostgresDB) SetInstanceFlag ¶ added in v0.7.0
func (d PostgresDB) SetInstanceFlag(name, value string) (bool, error)
func (PostgresDB) SetOIDCStorageValue ¶ added in v0.5.0
func (d PostgresDB) SetOIDCStorageValue(key string, payload string) error
func (PostgresDB) SetPadPublicStatus ¶ added in v0.7.0
func (d PostgresDB) SetPadPublicStatus(padID string, public bool) error
func (PostgresDB) SetPadSavedRevisions ¶ added in v0.7.0
func (d PostgresDB) SetPadSavedRevisions(padID string, saved []db.SavedRevision) error
func (PostgresDB) SetPadSettings ¶ added in v0.7.0
func (d PostgresDB) SetPadSettings(padID string, settings string) error
func (PostgresDB) SetReadOnlyId ¶ added in v0.0.4
func (d PostgresDB) SetReadOnlyId(padId string, readonlyId string) error
func (PostgresDB) SetSessionById ¶ added in v0.0.2
func (d PostgresDB) SetSessionById(sessionID string, session session2.Session) error
func (PostgresDB) TakeTokenTransfer ¶ added in v0.7.0
func (d PostgresDB) TakeTokenTransfer(id string) (*TokenTransfer, error)
func (PostgresDB) TouchAPIKey ¶ added in v0.7.0
func (d PostgresDB) TouchAPIKey(id string, at time.Time) error
func (PostgresDB) TouchAuthor ¶ added in v0.7.0
func (d PostgresDB) TouchAuthor(id string, at int64) error
func (PostgresDB) TouchLogin ¶ added in v0.7.0
func (d PostgresDB) TouchLogin(id string, at time.Time) error
func (PostgresDB) TouchToken ¶ added in v0.7.0
func (PostgresDB) TryLeadership ¶ added in v0.7.0
func (d PostgresDB) TryLeadership(name string) (Leadership, bool, error)
func (PostgresDB) UpdateAccount ¶ added in v0.7.0
func (d PostgresDB) UpdateAccount(a Account) error
func (PostgresDB) UpdatePadHead ¶ added in v0.7.0
func (PostgresDB) UpdatePadHeadText ¶ added in v0.7.0
func (PostgresDB) UpdateRole ¶ added in v0.7.0
func (d PostgresDB) UpdateRole(r Role) error
func (PostgresDB) UpdateToken ¶ added in v0.7.0
func (d PostgresDB) UpdateToken(t Token) error
type PostgresOptions ¶ added in v0.0.2
type PostgresOptions struct {
Username string
Password string
Port int
Host string
Database string
// MaxConns caps the connection pool; 0 means the default of 25.
MaxConns int
// PgBouncer avoids named prepared statements, for PgBouncer (or a
// similar pooler) in transaction mode.
PgBouncer bool
}
type RevisionDelta ¶ added in v0.7.0
RevisionDelta is a stored revision without its full text.
type Role ¶ added in v0.7.0
type Role struct {
ID string
Name string
Description string
Builtin bool
Scopes []string
// Includes are the ids of the roles this one includes.
Includes []string
// Limits by name (AI requests per day, ...).
Limits map[string]int64
}
Role is a named set of scopes that can include other roles.
type RoleAssignment ¶ added in v0.7.0
type RoleAssignment struct {
AccountID string
RoleID string
PadPattern string
CreatedBy string
CreatedAt time.Time
}
RoleAssignment gives an account a role, for all pads (PadPattern "") or the pads matching PadPattern.
type SQLiteDB ¶
type SQLiteDB struct {
// contains filtered or unexported fields
}
func NewSQLiteDB ¶ added in v0.0.2
NewSQLiteDB creates a new SQLiteDB and returns a pointer to it.
func (SQLiteDB) AddOIDCStorageValue ¶ added in v0.7.0
func (SQLiteDB) AddRoleAssignment ¶ added in v0.7.0
func (d SQLiteDB) AddRoleAssignment(a RoleAssignment) error
func (SQLiteDB) AppendAudit ¶ added in v0.7.0
func (d SQLiteDB) AppendAudit(e AuditEntry) error
func (SQLiteDB) ClaimReadOnlyId ¶ added in v0.7.0
func (SQLiteDB) ClearChatAuthorship ¶ added in v0.6.3
func (SQLiteDB) ConsumeAuthCode ¶ added in v0.7.0
func (SQLiteDB) CountChatMessagesOfAuthor ¶ added in v0.7.0
func (SQLiteDB) CreateAPIKey ¶ added in v0.7.0
func (SQLiteDB) CreateAccessToken ¶ added in v0.5.0
func (SQLiteDB) CreateAccount ¶ added in v0.7.0
func (SQLiteDB) CreateAuthCode ¶ added in v0.5.0
func (SQLiteDB) CreateOIDCSession ¶ added in v0.5.0
func (SQLiteDB) CreatePKCE ¶ added in v0.5.0
func (SQLiteDB) CreateRefreshToken ¶ added in v0.5.0
func (SQLiteDB) CreateRole ¶ added in v0.7.0
func (SQLiteDB) CreateToken ¶ added in v0.7.0
func (SQLiteDB) CreateTokenTransfer ¶ added in v0.7.0
func (d SQLiteDB) CreateTokenTransfer(t TokenTransfer) error
func (SQLiteDB) DeleteAPIKey ¶ added in v0.7.0
func (SQLiteDB) DeleteAccessToken ¶ added in v0.5.0
func (SQLiteDB) DeleteAccessTokensByRequestID ¶ added in v0.5.0
func (SQLiteDB) DeleteAccount ¶ added in v0.7.0
func (SQLiteDB) DeleteOIDCSession ¶ added in v0.5.0
func (SQLiteDB) DeleteOIDCStorageValue ¶ added in v0.5.0
func (SQLiteDB) DeletePKCE ¶ added in v0.5.0
func (SQLiteDB) DeleteRefreshToken ¶ added in v0.5.0
func (SQLiteDB) DeleteRole ¶ added in v0.7.0
func (SQLiteDB) DeleteSecretParams ¶ added in v0.6.5
func (SQLiteDB) DoesSheetExist ¶ added in v0.6.5
func (SQLiteDB) GetAPIKeyByHash ¶ added in v0.7.0
func (SQLiteDB) GetAccessToken ¶ added in v0.5.0
func (d SQLiteDB) GetAccessToken(signature string) (*OAuthTokenRow, error)
func (SQLiteDB) GetAccount ¶ added in v0.7.0
func (SQLiteDB) GetAccountByUsername ¶ added in v0.7.0
func (SQLiteDB) GetAuthCode ¶ added in v0.5.0
func (d SQLiteDB) GetAuthCode(signature string) (*OAuthTokenRow, error)
func (SQLiteDB) GetAuthorByMapper ¶ added in v0.7.0
func (SQLiteDB) GetAuthorByToken ¶
func (SQLiteDB) GetAuthorIdsOfPadChats ¶ added in v0.0.4
func (SQLiteDB) GetAuthorRow ¶ added in v0.7.0
func (SQLiteDB) GetAuthors ¶ added in v0.0.4
func (SQLiteDB) GetChatsOfPad ¶ added in v0.0.2
func (SQLiteDB) GetInstanceFlag ¶ added in v0.7.0
func (SQLiteDB) GetOIDCSession ¶ added in v0.5.0
func (d SQLiteDB) GetOIDCSession(signature string) (*OAuthTokenRow, error)
func (SQLiteDB) GetOIDCStorageValue ¶ added in v0.5.0
func (SQLiteDB) GetPKCE ¶ added in v0.5.0
func (d SQLiteDB) GetPKCE(signature string) (*OAuthTokenRow, error)
func (SQLiteDB) GetPadByReadOnlyId ¶ added in v0.0.4
func (SQLiteDB) GetPadIdsOfAuthor ¶ added in v0.0.4
func (SQLiteDB) GetPadVersion ¶ added in v0.7.0
func (d SQLiteDB) GetPadVersion(padID string) (*PadVersion, error)
func (SQLiteDB) GetRefreshToken ¶ added in v0.5.0
func (d SQLiteDB) GetRefreshToken(signature string) (*OAuthRefreshTokenRow, error)
func (SQLiteDB) GetRevision ¶
func (SQLiteDB) GetRevisionDeltas ¶ added in v0.7.0
func (d SQLiteDB) GetRevisionDeltas(padID string, fromRev, toRev int) ([]RevisionDelta, error)
func (SQLiteDB) GetRevisionPool ¶ added in v0.7.0
func (SQLiteDB) GetRevisions ¶ added in v0.0.2
func (SQLiteDB) GetServerVersion ¶ added in v0.0.5
func (d SQLiteDB) GetServerVersion() (*db.ServerVersion, error)
func (SQLiteDB) GetSessionById ¶
func (SQLiteDB) GetSheetOpInfo ¶ added in v0.7.0
func (SQLiteDB) GetSheetOps ¶ added in v0.6.5
func (SQLiteDB) GetSheetVersion ¶ added in v0.7.0
func (d SQLiteDB) GetSheetVersion(padId string) (*SheetVersion, error)
func (SQLiteDB) GetTokenByHash ¶ added in v0.7.0
func (SQLiteDB) HasAuditEntry ¶ added in v0.7.0
func (SQLiteDB) HeartbeatClusterNode ¶ added in v0.7.0
func (SQLiteDB) InvalidateAuthCode ¶ added in v0.5.0
func (SQLiteDB) ListAPIKeys ¶ added in v0.7.0
func (SQLiteDB) ListAccounts ¶ added in v0.7.0
func (SQLiteDB) ListAudit ¶ added in v0.7.0
func (d SQLiteDB) ListAudit(limit int) ([]AuditEntry, error)
func (SQLiteDB) ListClusterNodes ¶ added in v0.7.0
func (d SQLiteDB) ListClusterNodes(aliveSince time.Time) ([]ClusterNode, error)
func (SQLiteDB) ListPadIDs ¶ added in v0.7.0
func (d SQLiteDB) ListPadIDs(l PadListing) ([]string, error)
func (SQLiteDB) ListRoleAssignments ¶ added in v0.7.0
func (d SQLiteDB) ListRoleAssignments(accountID string) ([]RoleAssignment, error)
func (SQLiteDB) ListSecretParams ¶ added in v0.6.5
func (SQLiteDB) ListTokens ¶ added in v0.7.0
func (SQLiteDB) LockPadsExclusive ¶ added in v0.7.0
LockPadsExclusive locks within this process: an SQLite database is used by one process.
func (SQLiteDB) MarkAuthorErased ¶ added in v0.7.0
func (SQLiteDB) PruneClusterNodes ¶ added in v0.7.0
func (SQLiteDB) RemoveChat ¶
func (SQLiteDB) RemoveClusterNode ¶ added in v0.7.0
func (SQLiteDB) RemoveGroup ¶ added in v0.0.2
func (SQLiteDB) RemoveMapperOfAuthor ¶ added in v0.7.0
func (SQLiteDB) RemoveRevisionsOfPad ¶
func (SQLiteDB) RemoveRoleAssignment ¶ added in v0.7.0
func (SQLiteDB) RemoveSessionById ¶
func (SQLiteDB) RemoveSheet ¶ added in v0.6.5
func (SQLiteDB) RemoveSheetOps ¶ added in v0.6.5
func (SQLiteDB) RemoveTokenOfAuthor ¶ added in v0.6.3
func (SQLiteDB) RemoveTokenTransfersBefore ¶ added in v0.7.0
func (SQLiteDB) ReplaceRevisions ¶ added in v0.7.0
func (SQLiteDB) ResetSheet ¶ added in v0.7.0
func (SQLiteDB) RevokeRefreshToken ¶ added in v0.5.0
func (SQLiteDB) RevokeRefreshTokensByRequestID ¶ added in v0.5.0
func (SQLiteDB) SaveAuthorColor ¶
func (SQLiteDB) SaveAuthorName ¶
func (SQLiteDB) SaveChatHeadOfPad ¶ added in v0.0.2
func (SQLiteDB) SaveChatMessage ¶ added in v0.0.2
func (SQLiteDB) SaveRevision ¶
func (SQLiteDB) SaveSecretParams ¶ added in v0.6.5
func (SQLiteDB) SaveServerVersion ¶ added in v0.0.5
func (SQLiteDB) SaveSheetOp ¶ added in v0.6.5
func (SQLiteDB) SearchAuthors ¶ added in v0.7.0
func (d SQLiteDB) SearchAuthors(s AuthorSearch) ([]AuthorRow, error)
func (SQLiteDB) SetAPIKeyDisabled ¶ added in v0.7.0
func (SQLiteDB) SetAuthorByToken ¶
func (SQLiteDB) SetAuthorMapper ¶ added in v0.7.0
func (SQLiteDB) SetInstanceFlag ¶ added in v0.7.0
func (SQLiteDB) SetOIDCStorageValue ¶ added in v0.5.0
func (SQLiteDB) SetPadPublicStatus ¶ added in v0.7.0
func (SQLiteDB) SetPadSavedRevisions ¶ added in v0.7.0
func (d SQLiteDB) SetPadSavedRevisions(padID string, saved []db.SavedRevision) error
func (SQLiteDB) SetPadSettings ¶ added in v0.7.0
func (SQLiteDB) SetReadOnlyId ¶ added in v0.0.4
func (SQLiteDB) SetSessionById ¶
func (SQLiteDB) TakeTokenTransfer ¶ added in v0.7.0
func (d SQLiteDB) TakeTokenTransfer(id string) (*TokenTransfer, error)
func (SQLiteDB) TouchAPIKey ¶ added in v0.7.0
func (SQLiteDB) TouchAuthor ¶ added in v0.7.0
func (SQLiteDB) TouchLogin ¶ added in v0.7.0
func (SQLiteDB) TouchToken ¶ added in v0.7.0
func (SQLiteDB) TryLeadership ¶ added in v0.7.0
func (d SQLiteDB) TryLeadership(name string) (Leadership, bool, error)
func (SQLiteDB) UpdateAccount ¶ added in v0.7.0
func (SQLiteDB) UpdatePadHead ¶ added in v0.7.0
func (SQLiteDB) UpdatePadHeadText ¶ added in v0.7.0
func (SQLiteDB) UpdateRole ¶ added in v0.7.0
func (SQLiteDB) UpdateToken ¶ added in v0.7.0
type SecretMethods ¶ added in v0.6.5
type SecretMethods interface {
// SaveSecretParams upserts one published parameter set.
SaveSecretParams(id string, prefix string, payload string) error
// ListSecretParams returns all parameter sets for the given prefix as a
// map of id -> payload.
ListSecretParams(prefix string) (map[string]string, error)
// DeleteSecretParams removes a single parameter set by id.
DeleteSecretParams(id string) error
}
SecretMethods back the SecretRotator. Each published parameter set is addressed by a random id within a rotator namespace (prefix), allowing several rotators (and several Etherpad instances) to coexist in one table.
type ServerMethods ¶ added in v0.0.5
type ServerMethods interface {
GetServerVersion() (*db.ServerVersion, error)
SaveServerVersion(version string) error
}
type SessionMethods ¶
type SheetMethods ¶ added in v0.6.5
type SheetMethods interface {
SaveSheet(padId string, head int, snapshot string) error
GetSheet(padId string) (*db.SheetDB, error)
DoesSheetExist(padId string) (*bool, error)
RemoveSheet(padId string) error
// SaveSheetOp stores op as revision rev. Ops are write-once: if rev is
// taken (another instance stored it first) it returns ErrConflict.
SaveSheetOp(padId string, rev int, op string, authorId *string, timestamp int64) error
// GetSheetVersion returns what the stored sheet is at, without its
// snapshot.
GetSheetVersion(padId string) (*SheetVersion, error)
// ResetSheet replaces the workbook: it removes the ops, stores snapshot
// at head 0 and starts a new epoch, all or nothing. snapshot is also
// kept as the op row at rev 0, the base the history starts from.
ResetSheet(padId string, snapshot string) error
GetSheetOps(padId string, startRev int, endRev int) (*[]db.SheetOpDB, error)
// GetSheetOpInfo is GetSheetOps without the ops themselves (Op is
// empty): revision, author and time, for the version history.
GetSheetOpInfo(padId string, startRev int, endRev int) (*[]db.SheetOpDB, error)
RemoveSheetOps(padId string) error
}
SheetMethods persist spreadsheet documents (header snapshot + op-log), keyed by pad id (a sheet document is a pad with document_type "sheet").
type SheetVersion ¶ added in v0.7.0
type SheetVersion struct {
Exists bool
// Head is the revision the stored snapshot is at.
Head int
// OpHead is the highest stored op, 0 if none. The ops are the
// authoritative history: an op is stored before the snapshot, so OpHead
// can be ahead of Head.
OpHead int
// Epoch changes when the workbook is replaced and numbering restarts.
Epoch int
}
SheetVersion is what a stored sheet document is at.
func (*SheetVersion) Latest ¶ added in v0.7.0
func (v *SheetVersion) Latest() int
Latest is the revision the sheet is at.
type Token ¶ added in v0.7.0
type Token struct {
ID string
AccountID string
Name string
// Hash is the SHA-256 of the key, hex; the key itself is not stored.
Hash string
// Prefix is the start of the key, to tell keys apart in a list.
Prefix string
// Scopes are the scopes the token may use; "*" means all of them.
Scopes []string
// PadPattern limits the token to matching pads; "" means all pads.
PadPattern string
// ExpiresAt nil: never.
ExpiresAt *time.Time
// MaxExpiresAt is the latest a replaced token may work: its expiry
// before the rotation (nil: it had none). A grace period never goes
// past it.
MaxExpiresAt *time.Time
RevokedAt *time.Time
// ReplacedBy is the token a rotation made from this one; Predecessor
// the one it was made from.
ReplacedBy string
Predecessor string
// ClientID is the OAuth client of an OAuth token, "" for API keys.
ClientID string
CreatedBy string
CreatedAt time.Time
LastUsedAt *time.Time
LastUsedIP string
// Limits are the token's own limits, on top of those of the roles.
Limits map[string]int64
}
Token is an API key (and later an OAuth token) of an account. Its rights are those of the account, cut down to its scopes and pad pattern (lib/tokens).
type TokenMethods ¶ added in v0.7.0
type TokenMethods interface {
CreateToken(t Token) error
GetToken(id string) (*Token, error)
GetTokenByHash(hash string) (*Token, error)
// ListTokens lists the tokens of an account, or all with "", oldest
// first.
ListTokens(accountID string) ([]Token, error)
// UpdateToken writes the changeable fields: name, scopes, pad pattern,
// expiry and its cap, revocation, rotation and limits.
UpdateToken(t Token) error
// TouchToken records a use.
TouchToken(id string, at time.Time, ip string) error
}
TokenMethods store tokens.
Source Files
¶
- DataStore.go
- MemoryDataStore.go
- MemorySheet.go
- MySQLDB.go
- MySQLSheet.go
- PostgresDB.go
- PostgresSheet.go
- SQLiteDB.go
- SQLiteSheet.go
- accounts.go
- api_keys.go
- author_privacy.go
- cluster_nodes.go
- commonMappers.go
- consistency.go
- consistency_memory.go
- consistency_mysql.go
- consistency_postgres.go
- consistency_sqlite.go
- constants.go
- datastore_test_helper.go
- instance_flags.go
- leader.go
- pad_head.go
- pad_listing.go
- replace_revisions.go
- tokens.go