Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat (modl): Outline file & directory model (TBD) #309

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions connectors/file/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<!--
SPDX-License-Identifier: Apache-2.0

Copyright 2023 The Enola <https://enola.dev> Authors

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

https://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->

# File Model & Connector README

This models files in directories; [see the docs for how use it](../../docs/models/file/index.md).
87 changes: 87 additions & 0 deletions connectors/file/file.model.textproto
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
# SPDX-License-Identifier: Apache-2.0
#
# Copyright 2023 The Enola <https://enola.dev> Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# proto-file: dev/enola/core/meta/enola_meta.proto
# proto-message: EntityKinds

# TODO This should disappear and be read from extensions in file.proto

# TODO Add some VERBS, e.g. from
# https://en.m.wikipedia.org/wiki/Computer_file#Operations

kinds {
emoji: "🗎"
label: "File"
doc_url: "https://en.m.wikipedia.org/wiki/Computer_file"
# TODO This won't quite work yet (as paths are currently still fixed length)
id: { ns: "enola" entity: "file" paths: "name" }
related {
key: "parent"
value: {
id: { ns: "enola" entity: "directory" }
label: "Parent Folder"
description: "Folder which this File is in."
}
}
data {
key: "metadata"
value: {
label: "Metadata"
description: "Information about this File"
type_url: "model.enola.dev/dev.enola.file.Metadata"
}
}
link {
key: "content"
value: { uri_template: "file:" }
}
connectors {
# TODO Ideally a user should be able to decide if using this in-process or
# remote...
java_class: "dev.enola.file.FileConnector"
# grpc: "localhost:9090"
}
}

kinds {
emoji: "📁"
label: "Folder"
doc_url: "https://en.m.wikipedia.org/wiki/Directory_(computing)"
# TODO This won't quite work yet (as paths are currently still fixed length)
id: { ns: "enola" entity: "directory" paths: "name" }
related {
key: "parent"
value: {
id: { ns: "enola" entity: "directory" }
label: "Parent Folder"
description: "Folder which this File is in."
}
}
data {
key: "metadata"
value: {
label: "Metadata"
description: "Information about this File"
type_url: "model.enola.dev/dev.enola.file.Metadata"
}
}
connectors {
# TODO Ideally a user should be able to decide if using this in-process or
# remote...
java_class: "dev.enola.file.FileConnector"
# grpc: "localhost:9090"
}
}
46 changes: 46 additions & 0 deletions connectors/file/file.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
// SPDX-License-Identifier: Apache-2.0
//
// Copyright 2023 The Enola <https://enola.dev> Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

syntax = "proto3";

package dev.enola.file;

import "google/protobuf/timestamp.proto";

option java_string_check_utf8 = true;
option java_package = "dev.enola.file.proto";
option java_multiple_files = true;
option go_package = "dev/enola/file";

message File {
Metadata metadata = 1;
bytes content = 2;
}

message Directory {
Metadata metadata = 1;
repeated Metadata files = 2;
repeated Metadata directories = 3;
}

message Metadata {
string name = 1;
int64 size = 2;
string media_type = 3;

google.protobuf.Timestamp created = 10;
google.protobuf.Timestamp modified = 11;
}
20 changes: 20 additions & 0 deletions connectors/file/src/main/java/dev/enola/file/FileConnector.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/*
* SPDX-License-Identifier: Apache-2.0
*
* Copyright 2023 The Enola <https://enola.dev> Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package dev.enola.file;

public class FileConnector extends ConnectorServiceGrpc.ConnectorServiceImplBase {}
1 change: 1 addition & 0 deletions docs/models/file/file.model.textproto
1 change: 1 addition & 0 deletions docs/models/file/file.proto
37 changes: 37 additions & 0 deletions docs/models/file/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<!--
SPDX-License-Identifier: Apache-2.0

Copyright 2023 The Enola <https://enola.dev> Authors

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

https://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->

# File Model

## Usage

TODO

## Technical Information

### `file.proto`

```proto
{% include "file.proto" %}
```

### `file.model.textproto`

```textproto
{% include "file.model.textproto" %}
```