mirror of
https://github.com/zitadel/zitadel.git
synced 2024-12-12 19:14:23 +00:00
b5564572bc
This implementation increases parallel write capabilities of the eventstore. Please have a look at the technical advisories: [05](https://zitadel.com/docs/support/advisory/a10005) and [06](https://zitadel.com/docs/support/advisory/a10006). The implementation of eventstore.push is rewritten and stored events are migrated to a new table `eventstore.events2`. If you are using cockroach: make sure that the database user of ZITADEL has `VIEWACTIVITY` grant. This is used to query events.
46 lines
1.3 KiB
Go
46 lines
1.3 KiB
Go
package eventsourcing
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/zitadel/zitadel/internal/authz/repository"
|
|
authz_es "github.com/zitadel/zitadel/internal/authz/repository/eventsourcing/eventstore"
|
|
authz_view "github.com/zitadel/zitadel/internal/authz/repository/eventsourcing/view"
|
|
"github.com/zitadel/zitadel/internal/crypto"
|
|
"github.com/zitadel/zitadel/internal/database"
|
|
"github.com/zitadel/zitadel/internal/eventstore"
|
|
"github.com/zitadel/zitadel/internal/query"
|
|
)
|
|
|
|
type EsRepository struct {
|
|
authz_es.UserMembershipRepo
|
|
authz_es.TokenVerifierRepo
|
|
}
|
|
|
|
func Start(queries *query.Queries, es *eventstore.Eventstore, dbClient *database.DB, keyEncryptionAlgorithm crypto.EncryptionAlgorithm, externalSecure bool) (repository.Repository, error) {
|
|
view, err := authz_view.StartView(dbClient, queries)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return &EsRepository{
|
|
authz_es.UserMembershipRepo{
|
|
Queries: queries,
|
|
},
|
|
authz_es.TokenVerifierRepo{
|
|
TokenVerificationKey: keyEncryptionAlgorithm,
|
|
Eventstore: es,
|
|
View: view,
|
|
Query: queries,
|
|
ExternalSecure: externalSecure,
|
|
},
|
|
}, nil
|
|
}
|
|
|
|
func (repo *EsRepository) Health(ctx context.Context) error {
|
|
if err := repo.TokenVerifierRepo.Health(); err != nil {
|
|
return err
|
|
}
|
|
return nil
|
|
}
|