Documentation
¶
Index ¶
- Constants
- type Adapter
- func (a *Adapter) AcquireBatch(ctx context.Context, repoID string, stacks []string, user string, prNum int) error
- func (a *Adapter) GetDeployment(ctx context.Context, id string) (*model.Deployment, error)
- func (a *Adapter) GetDeploymentByPR(ctx context.Context, repoId string, prNumber int) (*model.Deployment, error)
- func (a *Adapter) GetJob(ctx context.Context, jobID string) (*model.Job, error)
- func (a *Adapter) GetRepositoryByID(ctx context.Context, id string) (*model.RepositoryMetadata, error)
- func (a *Adapter) GetRepositoryByName(ctx context.Context, name string) (*model.RepositoryMetadata, error)
- func (a *Adapter) GetRepositoryByURI(ctx context.Context, uri string) (*model.RepositoryMetadata, error)
- func (a *Adapter) Release(ctx context.Context, repoID, stackPath string) error
- func (a *Adapter) ReleaseBatch(ctx context.Context, repoID string, prNum int) error
- func (a *Adapter) SaveDeployment(ctx context.Context, d *model.Deployment) error
- func (a *Adapter) SaveJob(ctx context.Context, j model.Job) error
- func (a *Adapter) SaveRepository(ctx context.Context, r model.RepositoryMetadata) error
- func (a *Adapter) UpdateJobStatus(ctx context.Context, jobID string, st model.OpStatus) error
- type FirestoreStore
- func (s *FirestoreStore) AcquireLease(ctx context.Context, ref async.ExecutionRef, owner string, ttl time.Duration) (bool, async.Execution, error)
- func (s *FirestoreStore) FinalizeAfterRun(ctx context.Context, ref async.ExecutionRef) (bool, error)
- func (s *FirestoreStore) Get(ctx context.Context, ref async.ExecutionRef) (async.Execution, error)
- func (s *FirestoreStore) ListAll(ctx context.Context) ([]async.Execution, error)
- func (s *FirestoreStore) MarkDone(ctx context.Context, ref async.ExecutionRef, checkpoint string) error
- func (s *FirestoreStore) MarkFailed(ctx context.Context, ref async.ExecutionRef, errMsg string) error
- func (s *FirestoreStore) MarkWaiting(ctx context.Context, ref async.ExecutionRef, wakeAt time.Time, reason string, ...) error
- func (s *FirestoreStore) String() string
- func (s *FirestoreStore) UpsertQueued(ctx context.Context, ref async.ExecutionRef, wakeNow bool) (bool, error)
Constants ¶
const ( LocksCollection = "locks" // Locks de stacks (antes: "semaphores") DeploymentsCollection = "deployments" // Metadados de PRs JobsCollection = "jobs" // Execuções terraform RepositoriesCollection = "repositories" // Repos registrados )
Constantes para nomes de coleções Firestore
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Adapter ¶
type Adapter struct {
// contains filtered or unexported fields
}
func (*Adapter) AcquireBatch ¶
func (a *Adapter) AcquireBatch(ctx context.Context, repoID string, stacks []string, user string, prNum int) error
AcquireBatch tenta adquirir locks para múltiplos stacks Locks NÃO expiram - só são liberados explicitamente
func (*Adapter) GetDeployment ¶
func (*Adapter) GetDeploymentByPR ¶
func (a *Adapter) GetDeploymentByPR(ctx context.Context, repoId string, prNumber int) (*model.Deployment, error)
GetDeploymentByPR busca deployment por repo e PR number Usado para implementar idempotência no registro de plans Retorna erro se não encontrado
func (*Adapter) GetRepositoryByID ¶
func (a *Adapter) GetRepositoryByID(ctx context.Context, id string) (*model.RepositoryMetadata, error)
GetRepositoryByID busca repositório pelo ID nativo (chave primária)
func (*Adapter) GetRepositoryByName ¶
func (a *Adapter) GetRepositoryByName(ctx context.Context, name string) (*model.RepositoryMetadata, error)
GetRepositoryByName busca repositório pelo nome IMPORTANTE: Para uso durante migração/transição Considera-se legacy - preferir GetRepositoryByID
func (*Adapter) GetRepositoryByURI ¶
func (a *Adapter) GetRepositoryByURI(ctx context.Context, uri string) (*model.RepositoryMetadata, error)
GetRepositoryByURI busca repositório pela URI completa Útil para migração e lookup durante transição
func (*Adapter) ReleaseBatch ¶
ReleaseBatch libera todos os locks de um PR Usado quando PR é merged, closed, ou comando /unlock
func (*Adapter) SaveDeployment ¶
func (*Adapter) SaveRepository ¶
type FirestoreStore ¶
type FirestoreStore struct {
// contains filtered or unexported fields
}
func NewFirestoreStore ¶
func NewFirestoreStore(client *firestore.Client, collection string) *FirestoreStore
func (*FirestoreStore) AcquireLease ¶
func (*FirestoreStore) FinalizeAfterRun ¶
func (s *FirestoreStore) FinalizeAfterRun(ctx context.Context, ref async.ExecutionRef) (bool, error)
func (*FirestoreStore) Get ¶
func (s *FirestoreStore) Get(ctx context.Context, ref async.ExecutionRef) (async.Execution, error)
func (*FirestoreStore) ListAll ¶
(Opcional) utilitário de debug/observabilidade; não é parte do contrato.
func (*FirestoreStore) MarkDone ¶
func (s *FirestoreStore) MarkDone(ctx context.Context, ref async.ExecutionRef, checkpoint string) error
func (*FirestoreStore) MarkFailed ¶
func (s *FirestoreStore) MarkFailed(ctx context.Context, ref async.ExecutionRef, errMsg string) error
func (*FirestoreStore) MarkWaiting ¶
func (s *FirestoreStore) MarkWaiting(ctx context.Context, ref async.ExecutionRef, wakeAt time.Time, reason string, checkpoint string) error
func (*FirestoreStore) String ¶
func (s *FirestoreStore) String() string
func (*FirestoreStore) UpsertQueued ¶
func (s *FirestoreStore) UpsertQueued(ctx context.Context, ref async.ExecutionRef, wakeNow bool) (bool, error)