Skip to content

Commit 75667e3

Browse files
committed
PR(MAIN): Rename SourceHub ACP to Remote DAC (Vera)
Replace DefraDB-facing SourceHub terminology with Remote DAC while reserving Vera for the backing repository and network. Rename Go and C APIs, configuration and CLI surfaces, test harnesses, and generated docs. Note: breaking change becuase the document ACP type source-hub is now remote. Configuration moved from acp.document.sourceHub.* to acp.document.remote.*, --source-hub-address is now --remote-dac-address, and SourceHub Go/C symbols, test targets, and image variables were replaced by Remote DAC or Vera names.
1 parent 112e565 commit 75667e3

153 files changed

Lines changed: 470 additions & 446 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/test-coverage.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,15 +126,15 @@ jobs:
126126
"
127127
coverage-path: coverage.txt
128128

129-
# The document acp matrix job tests the combinations of source-hub acp and client types on linux.
129+
# The document ACP matrix job tests the combinations of document ACP types and client types on Linux.
130130
test-coverage-document-acp:
131131
name: Test coverage document acp job
132132

133133
strategy:
134134
fail-fast: false
135135
matrix:
136136
client-type: [go, http, cli, c]
137-
document-acp-type: [source-hub]
137+
document-acp-type: [remote]
138138

139139
runs-on: runs-on=${{ github.run_id }}-${{ github.run_attempt }}-${{ strategy.job-index }}/\
140140
spot=pco/cpu=16+32/family=c6*+c7*/disk=large/extras=s3-cache
@@ -165,7 +165,7 @@ jobs:
165165
- name: Test coverage & save coverage report in an artifact
166166
uses: ./.github/composites/test-coverage-with-artifact
167167
env:
168-
DEFRA_SOURCEHUB_IMAGE: ${{ steps.vera-image.outputs.image }}
168+
DEFRA_VERA_IMAGE: ${{ steps.vera-image.outputs.image }}
169169
with:
170170
coverage-artifact-name: "coverage_document_acp\
171171
_${{ matrix.document-acp-type }}\

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ You don't need to be an expert in all of these to contribute - many contribution
8080

8181
| Tool | When You Need It |
8282
|------|-----------------|
83-
| **[SourceHub](https://github.com/sourcenetwork/sourcehub)** | Working on access control features |
83+
| **[Vera](https://github.com/sourcenetwork/vera)** | Working on access control features |
8484
| **[Ollama](https://ollama.com/download)** | AI/vector embedding tests |
8585
| **[Make](https://www.gnu.org/software/make/)** | Convenient but not required - you can run `go` commands directly |
8686

CONTRIBUTING_INTERNAL.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
- [🔧 Quick Fix Checklist](#-quick-fix-checklist)
2929
- [🧪 Testing - Advanced](#-testing--advanced)
3030
- [🏃 Test Configuration Variables](#-test-configuration-variables)
31-
- [🌐 SourceHub ACP Tests](#-sourcehub-acp-tests)
31+
- [🌐 Remote Document ACP Tests](#-remote-document-acp-tests)
3232
- [📈 Benchmarks](#-benchmarks)
3333
- [🔍 Change Detector](#-change-detector)
3434
- [📦 Dependency Management](#-dependency-management)
@@ -188,18 +188,18 @@ The test suite uses environment variables to control which configurations are te
188188
| `DEFRA_BADGER_FILE` | `true`/`false` | Use file-based Badger store |
189189
| `DEFRA_BADGER_ENCRYPTION` | `true`/`false` | Enable Badger encryption |
190190
| `DEFRA_MUTATION_TYPE` | `gql` / `collection-named` / `collection-save` | Mutation type |
191-
| `DEFRA_DOCUMENT_ACP_TYPE` | `local` / `source-hub` | ACP type |
191+
| `DEFRA_DOCUMENT_ACP_TYPE` | `local` / `remote` | ACP type |
192192
| `DEFRA_LENS_TYPE` | `wasm-time` / `wasm-er` | Lens WASM runtime |
193193
| `DEFRA_VIEW_TYPE` | `cacheless` / `materialized` | View type |
194194
| `DEFRA_VECTOR_EMBEDDING` | `true`/`false` | Enable vector embedding tests |
195195

196-
### 🌐 SourceHub ACP Tests
196+
### 🌐 Remote Document ACP Tests
197197

198198
> [!WARNING]
199-
> SourceHub ACP tests require **Docker** and are resource-heavy.
199+
> Remote Document ACP tests use a Vera container, require **Docker**, and are resource-heavy.
200200
201201
```shell
202-
DEFRA_CLIENT_HTTP=true DEFRA_CLIENT_GO=false DEFRA_DOCUMENT_ACP_TYPE=source-hub \
202+
DEFRA_CLIENT_HTTP=true DEFRA_CLIENT_GO=false DEFRA_DOCUMENT_ACP_TYPE=remote \
203203
DEFRA_BADGER_MEMORY=true go test ./tests/integration/acp/... -count=1 -timeout 20m
204204
```
205205

Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -301,9 +301,9 @@ test\:gql-mutations:
301301
test\:col-named-mutations:
302302
DEFRA_MUTATION_TYPE=collection-named DEFRA_BADGER_MEMORY=true gotestsum --format pkgname -- $(DEFAULT_TEST_DIRECTORIES)
303303

304-
.PHONY: test\:source-hub
305-
test\:source-hub:
306-
DEFRA_DOCUMENT_ACP_TYPE=source-hub gotestsum --format pkgname -- $(DEFAULT_TEST_DIRECTORIES)
304+
.PHONY: test\:remote-dac
305+
test\:remote-dac:
306+
DEFRA_DOCUMENT_ACP_TYPE=remote gotestsum --format pkgname -- $(DEFAULT_TEST_DIRECTORIES)
307307

308308
.PHONY: test\:go
309309
test\:go:

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
</picture>
1212
</p>
1313

14-
DefraDB is a zero-trust database that prioritizes data verifiability, privacy, and information security. Its data model, powered by the convergence of [MerkleCRDTs](https://arxiv.org/pdf/2004.00107.pdf) and the content-addressability of [IPLD](https://docs.ipld.io/), enables a multi-write-master architecture. It features [DQL](https://docs.source.network/defradb/references/query-specification/query-language-overview), a query language compatible with GraphQL but providing extra convenience. By leveraging peer-to-peer networking it can be deployed nimbly in novel topologies. Access control is determined by a relationship-based DSL, supporting document or field-level policies, secured by the SourceHub network. DefraDB is a core part of the [Source technologies](https://source.network/) that enable new paradigms of decentralized data and access-control management, user-centric apps, data trustworthiness, and much more.
14+
DefraDB is a zero-trust database that prioritizes data verifiability, privacy, and information security. Its data model, powered by the convergence of [MerkleCRDTs](https://arxiv.org/pdf/2004.00107.pdf) and the content-addressability of [IPLD](https://docs.ipld.io/), enables a multi-write-master architecture. It features [DQL](https://docs.source.network/defradb/references/query-specification/query-language-overview), a query language compatible with GraphQL but providing extra convenience. By leveraging peer-to-peer networking it can be deployed nimbly in novel topologies. Access control is determined by a relationship-based DSL, supporting document or field-level policies, secured by the Vera network. DefraDB is a core part of the [Source technologies](https://source.network/) that enable new paradigms of decentralized data and access-control management, user-centric apps, data trustworthiness, and much more.
1515

1616
Read the documentation on [docs.source.network](https://docs.source.network/).
1717

acp/dac/bridge.go

Lines changed: 33 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,17 @@ import (
2222
acpTypes "github.com/sourcenetwork/defradb/acp/types"
2323
)
2424

25-
var _ acp.ACPSystemClient = (*SourceHubDocumentACP)(nil)
25+
var _ acp.ACPSystemClient = (*RemoteDocumentACP)(nil)
2626

2727
var _ DocumentACP = (*bridgeDocumentACP)(nil)
2828

2929
// bridgeDocumentACP wraps an [ACPSystemClient], hosting the DefraDB specific logic away
3030
// from ACP client specific code.
3131
type bridgeDocumentACP struct {
3232
clientACP acp.ACPSystemClient
33+
// documentACPType must only be set to [acpTypes.LocalDocumentACP] or
34+
// [acpTypes.RemoteDocumentACP]. [acpTypes.NodeACP] and future NAC types are invalid.
35+
documentACPType acpTypes.ACPSystemType
3336
}
3437

3538
func (a *bridgeDocumentACP) Start(ctx context.Context) error {
@@ -57,7 +60,7 @@ func (a *bridgeDocumentACP) AddPolicy(ctx context.Context, creator identity.Iden
5760
)
5861

5962
if err != nil {
60-
return "", acp.NewErrFailedToAddPolicy(err, "Local", creator.DID())
63+
return "", acp.NewErrFailedToAddPolicy(err, a.documentACPType.String(), creator.DID())
6164
}
6265

6366
log.InfoContext(ctx, "Created Policy", corelog.Any("PolicyID", policyID))
@@ -69,29 +72,18 @@ func (a *bridgeDocumentACP) ValidateResourceInterface(
6972
policyID string,
7073
resourceName string,
7174
) error {
72-
var err error
73-
switch a.clientACP.(type) {
74-
case *LocalDocumentACP:
75-
err = acp.ValidateResourceInterface(
76-
ctx,
77-
policyID,
78-
resourceName,
79-
acpTypes.LocalDocumentACP,
80-
a.clientACP,
81-
)
82-
case *SourceHubDocumentACP:
83-
err = acp.ValidateResourceInterface(
84-
ctx,
85-
policyID,
86-
resourceName,
87-
acpTypes.SourceHubDocumentACP,
88-
a.clientACP,
89-
)
90-
default:
75+
if a.documentACPType != acpTypes.LocalDocumentACP &&
76+
a.documentACPType != acpTypes.RemoteDocumentACP {
9177
return acp.ErrInvalidACPSystem
9278
}
9379

94-
return err
80+
return acp.ValidateResourceInterface(
81+
ctx,
82+
policyID,
83+
resourceName,
84+
a.documentACPType,
85+
a.clientACP,
86+
)
9587
}
9688

9789
func (a *bridgeDocumentACP) RegisterDocObject(
@@ -117,7 +109,14 @@ func (a *bridgeDocumentACP) RegisterDocObject(
117109
if ownerErr == nil && owner.HasValue() && owner.Value() == identity.DID() {
118110
return nil
119111
}
120-
return acp.NewErrFailedToRegisterDoc(err, "Local", policyID, identity.DID(), resourceName, docID)
112+
return acp.NewErrFailedToRegisterDoc(
113+
err,
114+
a.documentACPType.String(),
115+
policyID,
116+
identity.DID(),
117+
resourceName,
118+
docID,
119+
)
121120
}
122121

123122
return nil
@@ -136,7 +135,13 @@ func (a *bridgeDocumentACP) IsDocRegistered(
136135
docID,
137136
)
138137
if err != nil {
139-
return false, acp.NewErrFailedToCheckIfDocIsRegistered(err, "Local", policyID, resourceName, docID)
138+
return false, acp.NewErrFailedToCheckIfDocIsRegistered(
139+
err,
140+
a.documentACPType.String(),
141+
policyID,
142+
resourceName,
143+
docID,
144+
)
140145
}
141146

142147
return maybeActor.HasValue(), nil
@@ -169,7 +174,7 @@ func (a *bridgeDocumentACP) CheckDocAccess(
169174
if err != nil {
170175
return false, acp.NewErrFailedToVerifyDocAccess(
171176
err,
172-
"Local",
177+
a.documentACPType.String(),
173178
permissionThatImpliesRead.String(),
174179
policyID,
175180
actorID,
@@ -198,7 +203,7 @@ func (a *bridgeDocumentACP) CheckDocAccess(
198203
if err != nil {
199204
return false, acp.NewErrFailedToVerifyDocAccess(
200205
err,
201-
"Local",
206+
a.documentACPType.String(),
202207
permission.String(),
203208
policyID,
204209
actorID,
@@ -253,7 +258,7 @@ func (a *bridgeDocumentACP) AddDocActorRelationship(
253258
if err != nil {
254259
return false, acp.NewErrFailedToAddDocActorRelationship(
255260
err,
256-
"Local",
261+
a.documentACPType.String(),
257262
policyID,
258263
resourceName,
259264
docID,
@@ -321,7 +326,7 @@ func (a *bridgeDocumentACP) DeleteDocActorRelationship(
321326
if err != nil {
322327
return false, acp.NewErrFailedToDeleteDocActorRelationship(
323328
err,
324-
"Local",
329+
a.documentACPType.String(),
325330
policyID,
326331
resourceName,
327332
docID,

acp/dac/dac.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ type DocumentACP interface {
4646
// by assuming YAML format if JSON validation fails. Upon success a policyID is returned,
4747
// otherwise returns error.
4848
//
49-
// A policy can not be added without a creator identity (sourcehub address).
49+
// A policy cannot be added without a creator identity (a Vera address for Remote DAC).
5050
AddPolicy(ctx context.Context, creator identity.Identity, policy string) (string, error)
5151

5252
// ValidateResourceInterface performs resource interface validation of the linked/matching

acp/dac/doc.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@
99
// licenses/APL.txt.
1010

1111
/*
12-
This package implements local and sourcehub document access control systems.
12+
This package implements Local and Remote Document Access Control (DAC) systems.
1313
14-
Local document access control provides acp local to a node.
14+
Local DAC provides access control local to a node.
1515
16-
SourceHub document access control enables acp beyond just the local node.
16+
Remote DAC, backed by Vera, provides access control shared across nodes.
1717
*/
1818
package dac

acp/dac/local.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,14 @@ package dac
1313
import (
1414
"github.com/sourcenetwork/defradb/acp"
1515
"github.com/sourcenetwork/defradb/acp/local"
16+
acpTypes "github.com/sourcenetwork/defradb/acp/types"
1617
)
1718

1819
const localStoreName = "local_document_acp"
1920

2021
var _ acp.ACPSystemClient = (*LocalDocumentACP)(nil)
2122

22-
// LocalDocumentACP represents a local document acp implementation that makes no remote calls.
23+
// LocalDocumentACP represents the Local DAC implementation, which makes no remote calls.
2324
type LocalDocumentACP struct {
2425
*local.LocalACP
2526
}
@@ -31,6 +32,7 @@ func NewLocalDocumentACP(pathToStore string) (DocumentACP, error) {
3132
}
3233

3334
return &bridgeDocumentACP{
34-
clientACP: &LocalDocumentACP{LocalACP: localACP},
35+
clientACP: &LocalDocumentACP{LocalACP: localACP},
36+
documentACPType: acpTypes.LocalDocumentACP,
3537
}, nil
3638
}

0 commit comments

Comments
 (0)