feat(storage): add native PostgreSQL runtime and verified offline application import
Build and publish container images / images (push) Failing after 12m29s
Build and publish container images / images (push) Failing after 12m29s
This commit is contained in:
1 parent
96065d1e89
commit
0ba1dcfef0
243 files changed
+21441
-3090
No files matched your search
@@ -1,13 +1,28 @@
|
||||
package store
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/google/uuid"
|
||||
"pageswiki/internal/metadata"
|
||||
"time"
|
||||
)
|
||||
|
||||
// CreateObjectInDomain records provenance atomically for the API's create,
|
||||
// save, then bind workflow. It does not turn globally unique Objects into
|
||||
// Domain-local identities, nor infer ownership of legacy unbound Objects.
|
||||
func (s *Store) CreateObjectInDomain(domainUUID, kind string) (string, error) {
|
||||
if s.ReadOnly {
|
||||
return "", ErrReadOnly
|
||||
}
|
||||
if s.sqlBackend == storePostgreSQL {
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 15*time.Second)
|
||||
defer cancel()
|
||||
repo, err := metadata.NewApplication(s.DB, metadata.PostgreSQL)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return repo.CreateObject(ctx, domainUUID, kind)
|
||||
}
|
||||
if err := s.ensureLocalDomain(domainUUID); err != nil {
|
||||
return "", err
|
||||
}
|
||||
@@ -34,10 +49,10 @@ func (s *Store) CreateObjectInDomain(domainUUID, kind string) (string, error) {
|
||||
// Moving the last binding to another Domain never leaves source authority.
|
||||
func (s *Store) ObjectInDomainAuthorityScope(domainUUID, objectUUID string) (bool, error) {
|
||||
var allowed bool
|
||||
err := s.DB.QueryRow(`SELECT EXISTS(SELECT 1 FROM objects o WHERE o.uuid=? AND (
|
||||
EXISTS(SELECT 1 FROM paths p WHERE p.object_uuid=o.uuid AND p.domain_uuid=?) OR (
|
||||
err := s.DB.QueryRow(`SELECT EXISTS(SELECT 1 FROM objects o WHERE o.uuid=`+s.sqlParam(1)+` AND (
|
||||
EXISTS(SELECT 1 FROM paths p WHERE p.object_uuid=o.uuid AND p.domain_uuid=`+s.sqlParam(2)+`) OR (
|
||||
NOT EXISTS(SELECT 1 FROM paths p WHERE p.object_uuid=o.uuid) AND
|
||||
EXISTS(SELECT 1 FROM object_origins x WHERE x.object_uuid=o.uuid AND x.domain_uuid=?))
|
||||
EXISTS(SELECT 1 FROM object_origins x WHERE x.object_uuid=o.uuid AND x.domain_uuid=`+s.sqlParam(3)+`))
|
||||
))`, objectUUID, domainUUID, domainUUID).Scan(&allowed)
|
||||
return allowed, err
|
||||
return allowed, s.sqlError("object authority scope", err)
|
||||
}
|
||||
Reference in new issue
Block a user