postgres

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2026 License: Apache-2.0 Imports: 35 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrGraphPrecondition     = errors.New("graph generation or indexed commit changed")
	ErrGraphProviderConflict = errors.New("graph provider change requires explicit replacement")
)
View Source
var (
	ErrInvalidSecurityPrincipal = errors.New("invalid security principal")
	ErrInvalidAuditLimit        = errors.New("invalid audit limit")
)
View Source
var ErrLeaseLost = errors.New("index job lease lost")
View Source
var ErrNoJob = errors.New("no index job available")

Functions

func Migrate

func Migrate(ctx context.Context, pool *pgxpool.Pool) error

func Open

func Open(ctx context.Context, dsn string) (*pgxpool.Pool, error)

Types

type Delivery

type Delivery struct {
	ID, Event, State, ErrorCode  string
	InstallationID, RepositoryID *int64
}

type DeliveryTx

type DeliveryTx struct {
	// contains filtered or unexported fields
}

func (*DeliveryTx) DisableInstallation

func (tx *DeliveryTx) DisableInstallation(ctx context.Context, githubID int64, status string) error

func (*DeliveryTx) DisableRepository

func (tx *DeliveryTx) DisableRepository(ctx context.Context, githubID int64, errorCode string) error

func (*DeliveryTx) EnqueueIndex

func (tx *DeliveryTx) EnqueueIndex(ctx context.Context, request IndexRequest) error

func (*DeliveryTx) RenameRepository

func (tx *DeliveryTx) RenameRepository(ctx context.Context, githubID int64, owner, name, cloneURL, webURL string) error

func (*DeliveryTx) RepositoryForPush

func (tx *DeliveryTx) RepositoryForPush(ctx context.Context, installationID, githubID int64) (repository.Repository, error)

func (*DeliveryTx) UpdateRepositorySize

func (tx *DeliveryTx) UpdateRepositorySize(ctx context.Context, repositoryID, sizeBytes int64) error

type EnrichmentStatus

type EnrichmentStatus struct {
	Artifact  *graphartifact.Artifact
	ErrorCode string
}

type GraphJob

type GraphJob struct {
	ID, RepositoryID     int64
	TargetSHA            string
	State, LeaseOwner    string
	Attempt, MaxAttempts int
	LeaseExpiresAt       time.Time
}

type GraphPublication

type GraphPublication struct {
	Publisher           string
	Capabilities        []string
	ExpectedActiveID    int64
	AllowProviderChange bool
}

GraphPublication is trusted publication context, separate from producer facts. Zero ExpectedActiveID means no active generation, not an unconditional write. These storage APIs are deliberately absent from production upload interfaces.

type GraphReplacement

type GraphReplacement struct {
	Upload  GraphUpload
	Applied bool
}

type GraphSource

type GraphSource string
const (
	GraphSourceManaged  GraphSource = "managed"
	GraphSourceExternal GraphSource = "external"
	GraphSourceSCIP     GraphSource = "scip"
)

type GraphUpload

type GraphUpload struct {
	ID, RepositoryID                    int64
	Commit                              string
	SchemaVersion, NodeCount, EdgeCount int
	Source                              GraphSource
}

type IndexJob

type IndexJob struct {
	ID, RepositoryID             int64
	TargetSHA, TargetRef, Reason string
	State, LeaseOwner            string
	Attempt, Priority            int
	MaxAttempts                  int
	LeaseExpiresAt               time.Time
}

type IndexRequest

type IndexRequest struct {
	RepositoryID                 int64
	TargetSHA, TargetRef, Reason string
	Priority, MaxAttempts        int
}

type InstallationUpdate

type InstallationUpdate struct {
	GitHubID                          int64
	AccountLogin, AccountType, Status string
	SuspendedAt                       *time.Time
}

type RepositoryUpdate

type RepositoryUpdate struct {
	GitHubID, InstallationID      int64
	SizeBytes                     int64
	Owner, Name, CloneURL, WebURL string
	DefaultBranch                 string
	Private, Archived, Enabled    bool
}

type Store

type Store struct {
	// contains filtered or unexported fields
}

func New

func New(pool *pgxpool.Pool) *Store

func (*Store) APIPrincipal

func (s *Store) APIPrincipal(ctx context.Context, tokenHash [32]byte, now time.Time) (authn.Principal, error)

func (*Store) ActiveGraphJobIDs

func (s *Store) ActiveGraphJobIDs(ctx context.Context) (map[int64]struct{}, error)

func (*Store) ActiveJobIDs

func (s *Store) ActiveJobIDs(ctx context.Context) (map[int64]struct{}, error)

func (*Store) AdminDeliveries

func (s *Store) AdminDeliveries(ctx context.Context, installationID int64, repositoryIDs []int64, limit int) ([]admin.Delivery, bool, error)

func (*Store) AdminGitHub

func (s *Store) AdminGitHub(ctx context.Context, installationID int64, repositoryIDs []int64, c admin.GitHubConfig, limit int) (admin.GitHub, error)

func (*Store) AdminGroup

func (s *Store) AdminGroup(ctx context.Context, id int64) (admin.Group, error)

func (*Store) AdminGroups

func (s *Store) AdminGroups(ctx context.Context, limit int) ([]admin.Group, bool, error)

func (*Store) AdminJobs

func (s *Store) AdminJobs(ctx context.Context, installationID int64, repositoryIDs []int64, limit int, cursor *admin.JobCursor) ([]admin.Job, bool, error)

func (*Store) AdminOverview

func (s *Store) AdminOverview(ctx context.Context, installationID int64, repositoryIDs []int64) (admin.Overview, error)

func (*Store) AdminRepositories

func (s *Store) AdminRepositories(ctx context.Context, installationID int64, repositoryIDs []int64, limit int, cursor *admin.RepositoryCursor) ([]admin.Repository, bool, error)

AdminRepositories returns one page ordered by full name. The cursor is the last full name of the previous page; the keyset comparison keeps pages stable while repositories are added or renamed between requests.

func (*Store) AdminRepository

func (s *Store) AdminRepository(ctx context.Context, installationID int64, repositoryIDs []int64, githubID int64) (repository.Repository, error)

func (*Store) AdminSCIPDependencies

func (s *Store) AdminSCIPDependencies(ctx context.Context, installationID int64, repositoryIDs []int64, limit int) ([]admin.SCIPDependency, bool, error)

func (*Store) AdminSCIPUploads

func (s *Store) AdminSCIPUploads(ctx context.Context, installationID int64, repositoryIDs []int64, limit int) ([]admin.SCIPUpload, bool, error)

func (*Store) AdminUser

func (s *Store) AdminUser(ctx context.Context, id int64) (admin.User, error)

func (*Store) AdminUsers

func (s *Store) AdminUsers(ctx context.Context, limit int) ([]admin.User, bool, error)

func (*Store) AggregateStats

func (s *Store) AggregateStats(ctx context.Context, snapshot graphquery.QuerySnapshot) (graphprotocol.GraphStats, error)

func (*Store) AllAuthorizedRepositories

func (s *Store) AllAuthorizedRepositories(ctx context.Context, names []string) ([]repository.Repository, error)

func (*Store) AllowOAuthRequest

func (s *Store) AllowOAuthRequest(ctx context.Context, remoteAddr, endpoint string, now time.Time) (bool, error)

AllowOAuthRequest shares fixed-minute budgets across every server instance. Only the socket peer's canonical IP contributes to the source budget.

func (*Store) AnyAuthorizedRepository

func (s *Store) AnyAuthorizedRepository(ctx context.Context, repositoryID int64) (repository.Repository, error)

func (*Store) AppendAudit

func (s *Store) AppendAudit(ctx context.Context, event audit.Event) error

func (*Store) ApplyDelivery

func (s *Store) ApplyDelivery(ctx context.Context, delivery Delivery, callback func(context.Context, *DeliveryTx) error) (bool, error)

func (*Store) AuditEvents

func (s *Store) AuditEvents(ctx context.Context, limit int) ([]audit.Event, bool, error)

func (*Store) AuthorizedRepositories

func (s *Store) AuthorizedRepositories(ctx context.Context, installationID int64, repositoryIDs []int64, names []string) ([]repository.Repository, error)

func (*Store) AuthorizedRepository

func (s *Store) AuthorizedRepository(ctx context.Context, installationID int64, repositoryIDs []int64, repositoryID int64) (repository.Repository, error)

func (*Store) BindFederatedUser

func (s *Store) BindFederatedUser(ctx context.Context, issuer, subject, externalID string) (int64, error)

func (*Store) ClaimGraph

func (s *Store) ClaimGraph(ctx context.Context, owner string) (GraphJob, error)

func (*Store) ClaimIndex

func (s *Store) ClaimIndex(ctx context.Context, owner string) (IndexJob, error)

func (*Store) ClearLoginFailures

func (s *Store) ClearLoginFailures(ctx context.Context, accountKey, sourceKey [32]byte) error

func (*Store) CompleteGraph

func (s *Store) CompleteGraph(ctx context.Context, id int64, owner string, artifact graphartifact.Artifact) error

func (*Store) CompleteIndex

func (s *Store) CompleteIndex(ctx context.Context, id int64, owner string, enrichment ...EnrichmentStatus) error

func (*Store) ConsumeLoginAttempt

func (s *Store) ConsumeLoginAttempt(ctx context.Context, key [32]byte, now time.Time) (bool, time.Time, error)

func (*Store) ConsumeLoginFlow

func (s *Store) ConsumeLoginFlow(ctx context.Context, stateHash, browserHash [32]byte, provider string, now time.Time) (authn.LoginFlow, error)

func (*Store) CountFiles

func (s *Store) CountFiles(ctx context.Context, q graphquery.FileQuery) (int64, error)

CountFiles aggregates only the same selected immutable uploads and filters as the bounded page. It never loads file payloads or whole artifacts.

func (*Store) CountGeneratedFiles

func (s *Store) CountGeneratedFiles(ctx context.Context, snapshots []graphquery.QuerySnapshot) (generated, total int64, err error)

func (*Store) CreateAPIToken

func (s *Store) CreateAPIToken(ctx context.Context, token authn.APITokenRecord) (int64, error)

func (*Store) CreateAPITokenAudited

func (s *Store) CreateAPITokenAudited(ctx context.Context, token authn.APITokenRecord, event audit.Event) (int64, error)

func (*Store) CreateFederatedSessionAudited

func (s *Store) CreateFederatedSessionAudited(ctx context.Context, identity authn.Identity, session authn.SessionRecord, loginOperation string) error

func (*Store) CreateGroup

func (s *Store) CreateGroup(ctx context.Context, group scim.Group) (created scim.Group, err error)

func (*Store) CreateGroupAudited

func (s *Store) CreateGroupAudited(ctx context.Context, group scim.Group, events []audit.Event) (scim.Group, error)

func (*Store) CreateLoginFlow

func (s *Store) CreateLoginFlow(ctx context.Context, flow authn.LoginFlow) error

func (*Store) CreateOAuthAuthorizationRequest

func (s *Store) CreateOAuthAuthorizationRequest(ctx context.Context, request authn.OAuthAuthorizationRequest) error

func (*Store) CreateOAuthClient

func (s *Store) CreateOAuthClient(ctx context.Context, client authn.OAuthClient) error

func (*Store) CreateOAuthGrant

func (s *Store) CreateOAuthGrant(ctx context.Context, grant authn.OAuthGrant) (int64, error)

func (*Store) CreatePasswordSession

func (s *Store) CreatePasswordSession(ctx context.Context, userID int64, expected authn.PasswordCredential, session authn.SessionRecord, accountKey, sourceKey [32]byte) error

func (*Store) CreateSession

func (s *Store) CreateSession(ctx context.Context, session authn.SessionRecord) error

func (*Store) CreateSessionAudited

func (s *Store) CreateSessionAudited(ctx context.Context, session authn.SessionRecord, event audit.Event) error

func (*Store) CreateUser

func (s *Store) CreateUser(ctx context.Context, user scim.User) (created scim.User, err error)

func (*Store) CreateUserAudited

func (s *Store) CreateUserAudited(ctx context.Context, user scim.User, events []audit.Event) (scim.User, error)

func (*Store) DeleteExpiredAuth

func (s *Store) DeleteExpiredAuth(ctx context.Context, now time.Time) (flows, sessions int64, err error)

func (*Store) DeleteExpiredOAuth

func (s *Store) DeleteExpiredOAuth(ctx context.Context, now time.Time) (requests, grants, clients int64, err error)

DeleteExpiredOAuth removes finished browser interactions, grants that have been dead for a week (kept briefly for audit correlation), and clients idle for ninety days.

func (*Store) DeleteGroup

func (s *Store) DeleteGroup(ctx context.Context, id int64) (err error)

func (*Store) DeleteGroupAudited

func (s *Store) DeleteGroupAudited(ctx context.Context, id int64, events []audit.Event) error

func (*Store) DeleteOAuthAuthorizationRequest

func (s *Store) DeleteOAuthAuthorizationRequest(ctx context.Context, id [32]byte) error

func (*Store) DeleteUser

func (s *Store) DeleteUser(ctx context.Context, id int64) (err error)

func (*Store) DeleteUserAudited

func (s *Store) DeleteUserAudited(ctx context.Context, id int64, events []audit.Event) error

func (*Store) DesiredSHA

func (s *Store) DesiredSHA(ctx context.Context, id int64) (string, error)

func (*Store) DisableInstallation

func (s *Store) DisableInstallation(ctx context.Context, githubID int64, status string) error

func (*Store) EnqueueAdminIndex

func (s *Store) EnqueueAdminIndex(ctx context.Context, r admin.IndexRequest) error

func (*Store) EnqueueIndex

func (s *Store) EnqueueIndex(ctx context.Context, request IndexRequest) error

func (*Store) EntityGenerations

func (s *Store) EntityGenerations(ctx context.Context, snapshots []graphquery.QuerySnapshot) ([]graphprotocol.Generation, error)

Payload CASE expressions return a sentinel for oversized facts. Do not turn them into WHERE filters: dropping facts would falsely report complete answers. Only the caller's authorized repository set is inspected. The repository's current indexed SHA and active generation are checked together in one query.

func (*Store) EntityNeighbors

func (*Store) ExchangeOAuthCode

func (s *Store) ExchangeOAuthCode(ctx context.Context, codeID [32]byte, grant authn.OAuthGrant) (int64, error)

func (*Store) FailGraph

func (s *Store) FailGraph(ctx context.Context, id int64, owner, errorCode string, retry bool) error

func (*Store) FailIndex

func (s *Store) FailIndex(ctx context.Context, id int64, owner, errorCode string, retry bool) error

func (*Store) GraphArtifact

func (s *Store) GraphArtifact(ctx context.Context, repositoryID, uploadID int64) (graphartifact.Artifact, error)

func (*Store) GraphManifests

func (s *Store) GraphManifests(ctx context.Context) ([]graphartifact.Manifest, error)

func (*Store) GraphQueueDepths

func (s *Store) GraphQueueDepths(ctx context.Context) (map[string]int64, error)

func (*Store) GraphRepositories

func (s *Store) GraphRepositories(ctx context.Context, principal authn.Principal) ([]repository.Repository, error)

func (*Store) GraphStatus

func (s *Store) GraphStatus(ctx context.Context, repositoryID int64) (api.GraphStatus, error)

func (*Store) Group

func (s *Store) Group(ctx context.Context, id int64) (scim.Group, error)

func (*Store) Health

func (s *Store) Health(ctx context.Context) error

func (*Store) InstallationIDs

func (s *Store) InstallationIDs(ctx context.Context) ([]int64, error)

func (*Store) IssueOAuthCode

func (s *Store) IssueOAuthCode(ctx context.Context, pendingID, codeID, sessionHash [32]byte, userID int64, expiresAt, now time.Time) error

IssueOAuthCode atomically validates the consent session and re-keys a pending request as a code.

func (*Store) ListAPITokens

func (s *Store) ListAPITokens(ctx context.Context, userID int64) ([]authn.APITokenMetadata, error)

func (*Store) ListGroups

func (s *Store) ListGroups(ctx context.Context, filter scim.Filter, page scim.Page) ([]scim.Group, int, error)

func (*Store) ListOAuthGrants

func (s *Store) ListOAuthGrants(ctx context.Context, userID, afterID int64, limit int) ([]authn.OAuthGrantMetadata, bool, error)

func (*Store) ListUsers

func (s *Store) ListUsers(ctx context.Context, filter scim.Filter, page scim.Page) ([]scim.User, int, error)

func (*Store) LoadGraph

func (s *Store) LoadGraph(ctx context.Context, uploadID int64) (graphartifact.Artifact, error)

func (*Store) LoadGraphV2

func (s *Store) LoadGraphV2(ctx context.Context, repositoryID, uploadID int64) (*graphv2.Artifact, error)

LoadGraphV2 loads an immutable generation, including retired generations. The caller must authorize the repository; this is not a public download API.

func (*Store) Locations

func (s *Store) Locations(ctx context.Context, principal authn.Principal, origin scipgraph.StoredOccurrence, operation string, max int) ([]scipgraph.Location, bool, error)

func (*Store) Manifests

func (s *Store) Manifests(ctx context.Context) (map[int64]graphartifact.Manifest, error)

func (*Store) Neighbors

func (s *Store) Neighbors(ctx context.Context, query graphquery.NeighborQuery) ([]graphquery.Neighbor, error)

func (*Store) OAuthAuthorizationRequest

func (s *Store) OAuthAuthorizationRequest(ctx context.Context, id [32]byte, phase string, now time.Time) (authn.OAuthAuthorizationRequest, error)

func (*Store) OAuthClient

func (s *Store) OAuthClient(ctx context.Context, id string, _ time.Time) (authn.OAuthClient, error)

OAuthClient loads a client.

func (*Store) OAuthGrantByRefresh

func (s *Store) OAuthGrantByRefresh(ctx context.Context, refreshHash [32]byte, now time.Time) (authn.OAuthGrant, error)

func (*Store) OAuthPrincipal

func (s *Store) OAuthPrincipal(ctx context.Context, accessHash [32]byte, now time.Time) (authn.Principal, error)

OAuthPrincipal resolves a live access token with the user's repository read access, without delegating administrative or write privileges.

func (*Store) OccurrenceAt

func (s *Store) OccurrenceAt(ctx context.Context, repositoryID int64, commit, path string, line int, position scipgraph.OccurrencePosition) (scipgraph.StoredOccurrence, error)

func (*Store) PasswordCredential

func (s *Store) PasswordCredential(ctx context.Context, userName string) (int64, authn.PasswordCredential, error)

func (*Store) PatchGroup

func (s *Store) PatchGroup(ctx context.Context, id int64, mutation scim.GroupMutation) (updated scim.Group, err error)

func (*Store) PatchGroupAudited

func (s *Store) PatchGroupAudited(ctx context.Context, id int64, mutation scim.GroupMutation, events []audit.Event) (scim.Group, error)

func (*Store) PatchUser

func (s *Store) PatchUser(ctx context.Context, id int64, mutation scim.UserMutation) (updated scim.User, err error)

func (*Store) PatchUserAudited

func (s *Store) PatchUserAudited(ctx context.Context, id int64, mutation scim.UserMutation, events []audit.Event) (scim.User, error)

func (*Store) Prune

func (s *Store) Prune(ctx context.Context) (int64, int64, error)

func (*Store) PublishIndex

func (s *Store) PublishIndex(ctx context.Context, id int64, owner string) error

func (*Store) QueryAggregateNames

func (s *Store) QueryAggregateNames(ctx context.Context, q graphquery.AggregateNamesQuery) ([]string, error)

func (*Store) QueryAnalysisEntities

func (s *Store) QueryAnalysisEntities(ctx context.Context, query graphquery.AnalysisEntityQuery) ([]graphprotocol.Entity, error)

func (*Store) QueryAnalysisEvidence

func (s *Store) QueryAnalysisEvidence(ctx context.Context, query graphquery.AnalysisEvidenceQuery) ([]graphprotocol.Evidence, error)

func (*Store) QueryDiscovery

func (*Store) QueryEntities

func (s *Store) QueryEntities(ctx context.Context, q graphquery.EntityQuery) ([]graphprotocol.Entity, error)

func (*Store) QueryFileNodes

func (s *Store) QueryFileNodes(ctx context.Context, snapshot graphquery.QuerySnapshot, paths []string) ([]graphprotocol.Entity, error)

func (*Store) QueryFiles

func (*Store) QueryModuleAggregation

func (s *Store) QueryModuleAggregation(ctx context.Context, q graphquery.AggregateModuleQuery) ([]graphquery.AggregateModuleRow, error)

func (*Store) QueryNodeMetrics

func (s *Store) QueryNodeMetrics(ctx context.Context, snapshot graphquery.QuerySnapshot, occurrence string) (graphprotocol.NodeMetrics, error)

func (*Store) QuerySegments

func (*Store) QueryTopCallingFiles

func (s *Store) QueryTopCallingFiles(ctx context.Context, q graphquery.AggregateLimitQuery) ([]graphprotocol.CallingFile, error)

func (*Store) QueryTopDependedOn

func (s *Store) QueryTopDependedOn(ctx context.Context, q graphquery.AggregateLimitQuery) ([]graphprotocol.DependedOn, error)

func (*Store) QueueDepths

func (s *Store) QueueDepths(ctx context.Context) (map[string]int64, error)

func (*Store) ReapExpired

func (s *Store) ReapExpired(ctx context.Context, limit int) (int64, error)

func (*Store) ReapExpiredGraph

func (s *Store) ReapExpiredGraph(ctx context.Context, limit int) (int64, error)

func (*Store) RebuildGraphDiscovery

func (s *Store) RebuildGraphDiscovery(ctx context.Context, repositoryID, uploadID int64) error

RebuildGraphDiscovery is an explicit offline maintenance operation. It may load a full validated artifact; the request path never calls it. Immutable generation identity prevents a replacement from changing the facts rebuilt.

func (*Store) ReconcileAdminRepositories

func (s *Store) ReconcileAdminRepositories(ctx context.Context, installationID int64, repositoryIDs []int64, upstream []githubapp.Repository) error

func (*Store) ReconcileInstallation

func (s *Store) ReconcileInstallation(ctx context.Context, installation githubapp.Installation, repositories []githubapp.Repository) error

func (*Store) Record

func (s *Store) Record(ctx context.Context, event audit.Event) error

func (*Store) RenewGraphLease

func (s *Store) RenewGraphLease(ctx context.Context, id int64, owner string) error

func (*Store) RenewLease

func (s *Store) RenewLease(ctx context.Context, id int64, owner string) error

func (*Store) ReplaceAdminGroupAccess

func (s *Store) ReplaceAdminGroupAccess(ctx context.Context, actorID, groupID int64, administrator bool, repositoryIDs []int64) error

func (*Store) ReplaceAdminGroupAccessAudited

func (s *Store) ReplaceAdminGroupAccessAudited(ctx context.Context, actorID, groupID int64, administrator bool, repositoryIDs []int64, event audit.Event) error

func (*Store) ReplaceAdminUserAccess

func (s *Store) ReplaceAdminUserAccess(ctx context.Context, actorID, userID int64, administrator bool, repositoryIDs []int64) error

func (*Store) ReplaceAdminUserAccessAudited

func (s *Store) ReplaceAdminUserAccessAudited(ctx context.Context, actorID, userID int64, administrator bool, repositoryIDs []int64, event audit.Event) error

func (*Store) ReplaceGitHubGrants

func (s *Store) ReplaceGitHubGrants(ctx context.Context, userID int64, repositoryIDs []int64) error

ReplaceGitHubGrants mirrors bindProviderUser's grant replacement for a refresh-time sync: unknown repository IDs are dropped by the join.

func (*Store) ReplaceGraph

func (s *Store) ReplaceGraph(ctx context.Context, repositoryID int64, source GraphSource, artifact graphartifact.Artifact) (GraphReplacement, error)

func (*Store) ReplaceGraphV2

func (s *Store) ReplaceGraphV2(ctx context.Context, repositoryID int64, publication GraphPublication, artifact *graphv2.Artifact) (GraphReplacement, error)

func (*Store) ReplaceGroup

func (s *Store) ReplaceGroup(ctx context.Context, id int64, group scim.Group) (updated scim.Group, err error)

func (*Store) ReplaceGroupAudited

func (s *Store) ReplaceGroupAudited(ctx context.Context, id int64, group scim.Group, events []audit.Event) (scim.Group, error)

func (*Store) ReplacePackages

func (s *Store) ReplacePackages(ctx context.Context, repositoryID int64, source string, mappings []scipgraph.PackageMapping) error

func (*Store) ReplaceSCIP

func (s *Store) ReplaceSCIP(ctx context.Context, repositoryID int64, commit string, upload scipgraph.Upload) error

func (*Store) ReplaceUser

func (s *Store) ReplaceUser(ctx context.Context, id int64, user scim.User) (updated scim.User, err error)

func (*Store) ReplaceUserAudited

func (s *Store) ReplaceUserAudited(ctx context.Context, id int64, user scim.User, events []audit.Event) (scim.User, error)

func (*Store) RepositoryForIndex

func (s *Store) RepositoryForIndex(ctx context.Context, id int64) (repository.Repository, error)

func (*Store) RetryAdminJob

func (s *Store) RetryAdminJob(ctx context.Context, installationID int64, repositoryIDs []int64, id int64) error

func (*Store) RevokeAPIToken

func (s *Store) RevokeAPIToken(ctx context.Context, userID, tokenID int64) error

func (*Store) RevokeAPITokenAudited

func (s *Store) RevokeAPITokenAudited(ctx context.Context, userID, tokenID int64, event audit.Event) error

func (*Store) RevokeAdminUserCredentials

func (s *Store) RevokeAdminUserCredentials(ctx context.Context, userID int64) error

func (*Store) RevokeAdminUserCredentialsAudited

func (s *Store) RevokeAdminUserCredentialsAudited(ctx context.Context, userID int64, event audit.Event) error

func (*Store) RevokeOAuthGrant

func (s *Store) RevokeOAuthGrant(ctx context.Context, grantID int64) error

func (*Store) RevokeOAuthGrantByToken

func (s *Store) RevokeOAuthGrantByToken(ctx context.Context, hash [32]byte, clientID string) (bool, error)

func (*Store) RevokeSession

func (s *Store) RevokeSession(ctx context.Context, tokenHash [32]byte) error

func (*Store) RevokeSessionAudited

func (s *Store) RevokeSessionAudited(ctx context.Context, tokenHash [32]byte) error

func (*Store) RevokeUserOAuthGrant

func (s *Store) RevokeUserOAuthGrant(ctx context.Context, userID, grantID int64) error

func (*Store) RevokeUserOAuthGrantAudited

func (s *Store) RevokeUserOAuthGrantAudited(ctx context.Context, userID, grantID int64, event audit.Event) error

func (*Store) RotateOAuthGrant

func (s *Store) RotateOAuthGrant(ctx context.Context, refreshHash [32]byte, rotation authn.OAuthRotation) (authn.OAuthGrant, error)

RotateOAuthGrant implements refresh-token rotation with replay detection. Presenting any consumed refresh token after its rotation grace period revokes the grant and returns ErrOAuthReplay. Access use does not extend that grace.

func (*Store) RotatePasswordCredential

func (s *Store) RotatePasswordCredential(ctx context.Context, userID int64, expected, replacement authn.PasswordCredential, session authn.SessionRecord, accountKey, sourceKey [32]byte, event audit.Event) error

func (*Store) SCIPIndexCommit

func (s *Store) SCIPIndexCommit(ctx context.Context, repositoryID int64) (string, error)

func (*Store) SessionPrincipal

func (s *Store) SessionPrincipal(ctx context.Context, tokenHash [32]byte, now, idleUntil time.Time) (authn.Principal, error)

func (*Store) SetPasswordCredential

func (s *Store) SetPasswordCredential(ctx context.Context, userID int64, credential authn.PasswordCredential, event audit.Event) error

func (*Store) SuspendAdminUser

func (s *Store) SuspendAdminUser(ctx context.Context, actorID, userID int64, suspended bool) error

func (*Store) SuspendAdminUserAudited

func (s *Store) SuspendAdminUserAudited(ctx context.Context, actorID, userID int64, suspended bool, event audit.Event) error

func (*Store) Symbols

func (s *Store) Symbols(ctx context.Context, query graphquery.SymbolQuery) ([]graphprotocol.Symbol, error)

func (*Store) UpdateOAuthGrantGitHubToken

func (s *Store) UpdateOAuthGrantGitHubToken(ctx context.Context, grantID int64, ciphertext []byte) error

func (*Store) UpsertBreakGlassAdmin

func (s *Store) UpsertBreakGlassAdmin(ctx context.Context, userName string, credential authn.PasswordCredential, event audit.Event) (int64, error)

func (*Store) UpsertInstallation

func (s *Store) UpsertInstallation(ctx context.Context, update InstallationUpdate) error

func (*Store) UpsertRepository

func (s *Store) UpsertRepository(ctx context.Context, update RepositoryUpdate) (repository.Repository, error)

func (*Store) UpsertSearchNode

func (s *Store) UpsertSearchNode(ctx context.Context, nodeID, baseURL string) error

func (*Store) User

func (s *Store) User(ctx context.Context, id int64) (scim.User, error)

func (*Store) UserDisplayName

func (s *Store) UserDisplayName(ctx context.Context, userID int64) (string, error)

UserDisplayName renders "Display Name (user_name)" for the consent page.

func (*Store) UserPrincipal

func (s *Store) UserPrincipal(ctx context.Context, userID int64, ceiling []int64) (authn.Principal, error)

Jump to

Keyboard shortcuts

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