Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrPermissionNotFound = errors.New("permission not found")
View Source
var ErrTagNotFound = errors.New("tag not found")
View Source
var ErrUserNotFound = errors.New("user not found")
Functions ¶
This section is empty.
Types ¶
type ACLRepository ¶ added in v0.5.0
type ACLRepository interface {
GrantPermission(ctx context.Context, entry *model.ACLEntry) error
RevokePermission(ctx context.Context, userID uuid.UUID, moduleName string) error
ListUserPermissions(ctx context.Context, userID uuid.UUID) ([]*model.ACLEntry, error)
CheckPermission(ctx context.Context, userID uuid.UUID, moduleName string, permission model.Permission) (bool, error)
DeleteUserPermissions(ctx context.Context, userID uuid.UUID) error
}
func NewACLRepository ¶ added in v0.5.0
func NewACLRepository(pool *pgxpool.Pool, logger log.Logger) ACLRepository
type DriftRepository ¶ added in v0.6.0
type DriftRepository interface {
// GetTagsWithoutHashes returns tag IDs that have protofiles without content hashes
GetTagsWithoutHashes(ctx context.Context) ([]string, error)
// ComputeAndStoreHashes computes and stores content hashes for protofiles in a tag
ComputeAndStoreHashes(ctx context.Context, tagID string) error
// GetTagInfo returns module ID and tag name for a given tag ID
GetTagInfo(ctx context.Context, tagID string) (moduleID string, tagName string, err error)
// GetPreviousTagID returns the previous tag ID for the same module
GetPreviousTagID(ctx context.Context, moduleID string, currentTagID string) (string, error)
// GetFileHashesForTag returns filename to content hash mapping for a tag
GetFileHashesForTag(ctx context.Context, tagID string) (map[string]string, error)
// GetProtoFileContents returns filename to content mapping for a tag
GetProtoFileContents(ctx context.Context, tagID string) (map[string]string, error)
// SaveDriftEvents saves drift events to the database
SaveDriftEvents(ctx context.Context, events []model.DriftEvent) error
// GetUnacknowledgedDriftEvents returns all unacknowledged drift events
GetUnacknowledgedDriftEvents(ctx context.Context) ([]model.DriftEvent, error)
// AcknowledgeDriftEvent marks a drift event as acknowledged
AcknowledgeDriftEvent(ctx context.Context, eventID string, acknowledgedBy string) error
// GetDriftEventsForModule returns drift events for a specific module by name
// If tagName is provided (non-empty), it filters events by tag name
GetDriftEventsForModule(ctx context.Context, moduleName string, tagName string) ([]model.DriftEvent, error)
// GetModuleDependencyDriftStatuses returns dependency update statuses for a module tag
GetModuleDependencyDriftStatuses(ctx context.Context, moduleName string, tagName string) ([]model.DependencyDriftStatus, error)
}
DriftRepository handles drift detection data operations
func NewDriftRepository ¶ added in v0.6.0
func NewDriftRepository(pool *pgxpool.Pool, logger log.Logger) DriftRepository
NewDriftRepository creates a new drift repository
type MetadataRepository ¶ added in v0.4.0
type MetadataRepository interface {
GetUnprocessedTagIds(ctx context.Context) ([]string, error)
GetProtoFilesForTagId(ctx context.Context, tagId string) ([]*v1.ProtoFile, error)
SaveParsedProtoFiles(ctx context.Context, tagId string, files []*model.ParsedProtoFile) error
GetParsedProtoFiles(ctx context.Context, tagId string) ([]*model.ParsedProtoFile, error)
GetTagMetaByTagId(ctx context.Context, tagId string) (*model.TagMeta, error)
}
func NewMetadataRepository ¶ added in v0.4.0
func NewMetadataRepository(pool *pgxpool.Pool, logger log.Logger) MetadataRepository
NewMetadataRepository create a new metadata repository with pool
type RegistryRepository ¶
type RegistryRepository interface {
RegisterModule(ctx context.Context, moduleName string) error
GetModule(ctx context.Context, name string) (*v1.Module, error)
ListModules(ctx context.Context, pageSize int, token string) ([]*v1.Module, string, error)
DeleteModule(ctx context.Context, name string) error
PushModule(ctx context.Context, name string, tag string, protofiles []*v1.ProtoFile) (*v1.Module, error)
PushDraftModule(ctx context.Context, name string, tag string, protofiles []*v1.ProtoFile, dependencies []*v1.Dependency) (*v1.Module, error)
PullModule(ctx context.Context, name string, tag string) (*v1.Module, []*v1.ProtoFile, error)
PullDraftModule(ctx context.Context, name string, tag string) (*v1.Module, []*v1.ProtoFile, error)
GetModuleTagId(ctx context.Context, moduleName string, tag string) (string, error)
DeleteModuleTag(ctx context.Context, name string, tag string) error
AddModuleDependencies(ctx context.Context, name string, tag string, dependencies []*v1.Dependency) error
GetModuleDependencies(ctx context.Context, name string, tag string) ([]*v1.Dependency, error)
DeleteObsoleteDraftTags(ctx context.Context) error
}
func NewRegistryRepository ¶
func NewRegistryRepository(pool *pgxpool.Pool, logger log.Logger) RegistryRepository
type UserRepository ¶ added in v0.5.0
type UserRepository interface {
CreateUser(ctx context.Context, user *model.User) error
GetUser(ctx context.Context, id uuid.UUID) (*model.User, error)
GetUserByName(ctx context.Context, name string) (*model.User, error)
GetUserByToken(ctx context.Context, token string) (*model.User, error)
ListUsers(ctx context.Context, limit int, offset int) ([]*model.User, error)
UpdateUser(ctx context.Context, user *model.User) error
DeleteUser(ctx context.Context, id uuid.UUID) error
SetUserActive(ctx context.Context, id uuid.UUID, isActive bool) error
}
func NewUserRepository ¶ added in v0.5.0
func NewUserRepository(pool *pgxpool.Pool, logger log.Logger) UserRepository
Click to show internal directories.
Click to hide internal directories.