Skip to content

Commit 2febcca

Browse files
Unify UUID protobuf messages (#4)
1 parent da1dc01 commit 2febcca

13 files changed

Lines changed: 84 additions & 71 deletions

File tree

.github/workflows/buf.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ on:
55
push:
66
branches: [main]
77
pull_request:
8+
types: [ opened, synchronize, reopened, labeled, unlabeled ]
89
merge_group:
910
branches: ["**"]
1011

apis/datasets/v1/collections.proto

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,14 @@ package datasets.v1;
66

77
import "datasets/v1/core.proto";
88
import "google/protobuf/go_features.proto";
9+
import "tilebox/v1/id.proto";
910

1011
option features.(pb.go).api_level = API_OPAQUE;
1112
option features.field_presence = IMPLICIT;
1213

1314
// CreateCollectionRequest is used to create a new collection.
1415
message CreateCollectionRequest {
15-
ID dataset_id = 1; // The dataset id where the collection should be created.
16+
tilebox.v1.ID dataset_id = 1; // The dataset id where the collection should be created.
1617
string name = 2; // The name of the collection to create.
1718
}
1819

@@ -21,13 +22,13 @@ message GetCollectionByNameRequest {
2122
string collection_name = 1; // The name of the collection to retrieve.
2223
bool with_availability = 2; // If true, the response will include the availability interval.
2324
bool with_count = 3; // If true, the response will include the number of entries.
24-
ID dataset_id = 4; // The dataset id.
25+
tilebox.v1.ID dataset_id = 4; // The dataset id.
2526
}
2627

2728
// DeleteCollectionRequest contains the request parameters for deleting a single collection.
2829
message DeleteCollectionRequest {
29-
ID collection_id = 1; // The id of the collection to delete.
30-
ID dataset_id = 2; // The dataset id.
30+
tilebox.v1.ID collection_id = 1; // The id of the collection to delete.
31+
tilebox.v1.ID dataset_id = 2; // The dataset id.
3132
}
3233

3334
// DeleteCollectionResponse is the response to DeleteCollectionRequest.
@@ -36,7 +37,7 @@ message DeleteCollectionResponse {}
3637
// ListCollectionsRequest contains the request parameters
3738
// for retrieving a list of all available collections for a given dataset.
3839
message ListCollectionsRequest {
39-
ID dataset_id = 1; // The dataset id.
40+
tilebox.v1.ID dataset_id = 1; // The dataset id.
4041
bool with_availability = 2; // If true, the response will include the availability interval.
4142
bool with_count = 3; // If true, the response will include the number of entries.
4243
}

apis/datasets/v1/core.proto

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,11 @@ import "datasets/v1/dataset_type.proto";
2020
import "google/protobuf/go_features.proto";
2121
// https://protobuf.dev/reference/protobuf/google.protobuf/#timestamp
2222
import "google/protobuf/timestamp.proto";
23+
import "tilebox/v1/id.proto";
2324

2425
option features.(pb.go).api_level = API_OPAQUE;
2526
option features.field_presence = IMPLICIT;
2627

27-
/*
28-
* General, multi purpose messages
29-
*/
30-
message ID {
31-
bytes uuid = 1;
32-
}
33-
3428
// A time interval
3529
message TimeInterval {
3630
google.protobuf.Timestamp start_time = 1; // Start time of the interval.
@@ -46,8 +40,8 @@ message TimeInterval {
4640

4741
// A datapoint interval
4842
message DatapointInterval {
49-
ID start_id = 1; // The id of the first data point in the interval.
50-
ID end_id = 2; // The id of the last data point in the interval.
43+
tilebox.v1.ID start_id = 1; // The id of the first data point in the interval.
44+
tilebox.v1.ID end_id = 2; // The id of the last data point in the interval.
5145

5246
// We use exclusive for start and inclusive for end, because that way when both are false
5347
// we have a half-open interval [start, end) which is the default behaviour we want to achieve.
@@ -74,7 +68,7 @@ message Pagination {
7468
int64 limit = 1 [features.field_presence = EXPLICIT];
7569
// Return entries starting after this entry.
7670
// This is the id of the last entry returned in the previous page as the next parameter in each paginated query.
77-
ID starting_after = 2 [features.field_presence = EXPLICIT];
71+
tilebox.v1.ID starting_after = 2 [features.field_presence = EXPLICIT];
7872
}
7973

8074
// Any is a message that can hold any other message as bytes.
@@ -128,7 +122,7 @@ message Datapoint {
128122
message Collection {
129123
string legacy_id = 1; // Here for backwards compatibility, to be removed in the future.
130124
string name = 2;
131-
ID id = 3;
125+
tilebox.v1.ID id = 3;
132126
}
133127

134128
// CollectionInfo contains information about the data available in a dataset collection
@@ -146,9 +140,9 @@ message CollectionInfos {
146140
// Dataset contains information about a single dataset
147141
message Dataset {
148142
// dataset id
149-
ID id = 1;
143+
tilebox.v1.ID id = 1;
150144
// the dataset group to which this dataset belongs
151-
ID group_id = 2;
145+
tilebox.v1.ID group_id = 2;
152146
// the type of the dataset
153147
AnnotatedType type = 3;
154148
// normalized snake case name of the dataset, which can be used as a valid code identifier
@@ -190,9 +184,9 @@ enum Visibility {
190184
// DatasetGroup represent a dataset group
191185
message DatasetGroup {
192186
// group id
193-
ID id = 1;
187+
tilebox.v1.ID id = 1;
194188
// optional parent group id
195-
ID parent_id = 2;
189+
tilebox.v1.ID parent_id = 2;
196190
// normalized snake case name of the dataset group, which can be used as a valid code identifier
197191
string code_name = 3;
198192
// display name of the group

apis/datasets/v1/data_access.proto

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ package datasets.v1;
77
import "datasets/v1/core.proto";
88
import "datasets/v1/well_known_types.proto";
99
import "google/protobuf/go_features.proto";
10+
import "tilebox/v1/id.proto";
1011

1112
option features.(pb.go).api_level = API_OPAQUE;
1213
option features.field_presence = IMPLICIT;
@@ -38,8 +39,8 @@ message GetDatapointByIdRequest {
3839

3940
// QueryByIDRequest contains the request parameters for retrieving a single data point by its id.
4041
message QueryByIDRequest {
41-
repeated ID collection_ids = 1; // collection ids to query.
42-
ID id = 2; // The id of the requested data point.
42+
repeated tilebox.v1.ID collection_ids = 1; // collection ids to query.
43+
tilebox.v1.ID id = 2; // The id of the requested data point.
4344
bool skip_data = 3; // If true, only the datapoint metadata is returned.
4445
}
4546

@@ -78,7 +79,7 @@ message SpatialFilter {
7879

7980
// QueryRequest contains the request parameters for retrieving data from a Tilebox dataset.
8081
message QueryRequest {
81-
repeated ID collection_ids = 1; // collection ids to query.
82+
repeated tilebox.v1.ID collection_ids = 1; // collection ids to query.
8283
QueryFilters filters = 2; // Filters to apply to the query.
8384

8485
Pagination page = 3 [features.field_presence = EXPLICIT]; // The pagination parameters for this request.

apis/datasets/v1/data_ingestion.proto

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,15 @@ package datasets.v1;
66

77
import "datasets/v1/core.proto";
88
import "google/protobuf/go_features.proto";
9+
import "tilebox/v1/id.proto";
910

1011
option features.(pb.go).api_level = API_OPAQUE;
1112
option features.field_presence = IMPLICIT;
1213

1314
// Legacy ingest request
1415
// IngestDatapointsRequest is used to ingest one or multiple datapoints into a collection.
1516
message IngestDatapointsRequest {
16-
ID collection_id = 1; // The collection to insert the datapoints into.
17+
tilebox.v1.ID collection_id = 1; // The collection to insert the datapoints into.
1718

1819
Datapoints datapoints = 2;
1920

@@ -26,7 +27,7 @@ message IngestDatapointsRequest {
2627

2728
// IngestRequest is used to ingest one or multiple datapoints into a collection.
2829
message IngestRequest {
29-
ID collection_id = 1; // The collection to insert the datapoints into.
30+
tilebox.v1.ID collection_id = 1; // The collection to insert the datapoints into.
3031

3132
// The datapoints to insert. The values here are encoded protobuf messages. The type of the message is determined
3233
// by the type of the dataset that the specified collection belongs to.
@@ -44,13 +45,13 @@ message IngestRequest {
4445
message IngestResponse {
4546
int64 num_created = 1; // The number of datapoints that were created.
4647
int64 num_existing = 2; // The number of datapoints that were ignored because they already existed.
47-
repeated ID datapoint_ids = 3; // The ids of the datapoints in the same order as the datapoints in the request.
48+
repeated tilebox.v1.ID datapoint_ids = 3; // The ids of the datapoints in the same order as the datapoints in the request.
4849
}
4950

5051
// DeleteRequest is used to delete multiple datapoints from a collection.
5152
message DeleteRequest {
52-
ID collection_id = 1;
53-
repeated ID datapoint_ids = 2;
53+
tilebox.v1.ID collection_id = 1;
54+
repeated tilebox.v1.ID datapoint_ids = 2;
5455
}
5556

5657
// DeleteResponse is used to indicate that multiple datapoints were deleted.

apis/datasets/v1/dataset_type.proto

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import "datasets/v1/well_known_types.proto";
88
import "google/protobuf/descriptor.proto";
99
import "google/protobuf/go_features.proto";
1010
import "google/protobuf/timestamp.proto";
11+
import "tilebox/v1/id.proto";
1112

1213
option features.(pb.go).api_level = API_OPAQUE;
1314
option features.field_presence = IMPLICIT;
@@ -69,15 +70,15 @@ message AnnotatedType {
6970
// message types that are Temporal Datasets.
7071
message TemporalDatapoint {
7172
google.protobuf.Timestamp time = 1; // The timestamp associated with ach data point.
72-
UUID id = 2; // A universally unique identifier (UUID) that uniquely identifies each data point.
73+
tilebox.v1.ID id = 2; // A universally unique identifier (UUID) that uniquely identifies each data point.
7374
google.protobuf.Timestamp ingestion_time = 3; // The time the data point was ingested into the Tilebox API.
7475
}
7576

7677
// SpatioTemporalDatapoint is a single datapoint in a spatiotemporal dataset. The message is a superset of all
7778
// message types that are spatiotemporal Datasets.
7879
message SpatioTemporalDatapoint {
7980
google.protobuf.Timestamp time = 1; // The timestamp associated with each data point.
80-
UUID id = 2; // A universally unique identifier (UUID) that uniquely identifies each data point.
81+
tilebox.v1.ID id = 2; // A universally unique identifier (UUID) that uniquely identifies each data point.
8182
google.protobuf.Timestamp ingestion_time = 3; // The time the data point was ingested into the Tilebox API.
8283
Geometry geometry = 4; // The geometry associated with each data point.
8384
}

apis/datasets/v1/datasets.proto

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ package datasets.v1;
77
import "datasets/v1/core.proto";
88
import "datasets/v1/dataset_type.proto";
99
import "google/protobuf/go_features.proto";
10+
import "tilebox/v1/id.proto";
1011

1112
option features.(pb.go).api_level = API_OPAQUE;
1213
option features.field_presence = IMPLICIT;
@@ -28,13 +29,13 @@ message GetDatasetRequest {
2829
// slug of the dataset to be returned, e.g. "open_data.copernicus.sentinel1_sar"
2930
string slug = 1;
3031
// or alternatively a dataset id
31-
ID id = 2;
32+
tilebox.v1.ID id = 2;
3233
}
3334

3435
// UpdateDatasetRequest is used to update a dataset.
3536
message UpdateDatasetRequest {
3637
// id of the dataset to update.
37-
ID id = 1;
38+
tilebox.v1.ID id = 1;
3839
// updated name of the dataset.
3940
string name = 2;
4041
// updated type of the dataset.
@@ -64,15 +65,15 @@ message Package {
6465
// UpdateDatasetDescriptionRequest is used to update a dataset description
6566
message UpdateDatasetDescriptionRequest {
6667
// dataset id
67-
ID id = 1;
68+
tilebox.v1.ID id = 1;
6869
// description of the dataset, in markdown format
6970
string description = 2;
7071
}
7172

7273
// DeleteDatasetRequest is used to delete a dataset
7374
message DeleteDatasetRequest {
7475
// id of the dataset to delete.
75-
ID id = 1;
76+
tilebox.v1.ID id = 1;
7677
}
7778

7879
// DeleteDatasetResponse is the response to DeleteDatasetRequest

apis/datasets/v1/timeseries.proto

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,16 @@ package datasets.v1;
77
import "datasets/v1/core.proto";
88
import "google/protobuf/duration.proto";
99
import "google/protobuf/go_features.proto";
10+
import "tilebox/v1/id.proto";
1011

1112
option features.(pb.go).api_level = API_OPAQUE;
1213
option features.field_presence = IMPLICIT;
1314

1415
// TimeseriesDatasetChunk is a message that represents a chunk of a timeseries dataset.
1516
// used by workflow tasks that are executed once for each datapoint in a timeseries dataset
1617
message TimeseriesDatasetChunk {
17-
ID dataset_id = 1;
18-
ID collection_id = 2;
18+
tilebox.v1.ID dataset_id = 1;
19+
tilebox.v1.ID collection_id = 2;
1920
TimeInterval time_interval = 3;
2021
DatapointInterval datapoint_interval = 4;
2122
int32 branch_factor = 5;

apis/tilebox/v1/id.proto

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
edition = "2023";
2+
3+
package tilebox.v1;
4+
5+
import "google/protobuf/go_features.proto";
6+
7+
option features.(pb.go).api_level = API_OPAQUE;
8+
option features.field_presence = IMPLICIT;
9+
10+
// Bytes field (in message)
11+
message ID {
12+
bytes uuid = 1;
13+
}

apis/workflows/v1/automation.proto

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ package workflows.v1;
77
import "google/protobuf/empty.proto";
88
import "google/protobuf/go_features.proto";
99
import "google/protobuf/timestamp.proto";
10+
import "tilebox/v1/id.proto";
1011
import "workflows/v1/core.proto";
1112

1213
option features.(pb.go).api_level = API_OPAQUE;
@@ -22,7 +23,7 @@ enum StorageType {
2223

2324
// Storage location is some kind of storage that can contain data files or objects and be used as a trigger source.
2425
message StorageLocation {
25-
UUID id = 1; // Unique identifier for the storage location
26+
tilebox.v1.ID id = 1; // Unique identifier for the storage location
2627
string location = 2; // A unique identifier for the storage location in the storage system
2728
StorageType type = 3; // The type of the storage location, e.g. GCS, S3, FS
2829
}
@@ -35,7 +36,7 @@ message StorageLocations {
3536
// AutomationPrototype is a task prototype that can result in many submitted tasks. Task submissions are triggered by
3637
// NRT triggers, such as bucket triggers or cron triggers.
3738
message AutomationPrototype {
38-
UUID id = 1; // Unique identifier for the trigger
39+
tilebox.v1.ID id = 1; // Unique identifier for the trigger
3940
string name = 2; // A human-readable name for the trigger
4041
TaskSubmission prototype = 3; // The task submission to trigger
4142

@@ -51,14 +52,14 @@ message Automations {
5152
// StorageEventTrigger is a trigger that will trigger a task submission when an object matching the glob pattern is
5253
// created in a storage location.
5354
message StorageEventTrigger {
54-
UUID id = 1; // Unique identifier for the trigger
55+
tilebox.v1.ID id = 1; // Unique identifier for the trigger
5556
StorageLocation storage_location = 2; // The storage location to watch for events
5657
string glob_pattern = 3; // A glob pattern to match objects/files in the storage location
5758
}
5859

5960
// CronTrigger is a trigger that will trigger a task submission on a schedule.
6061
message CronTrigger {
61-
UUID id = 1; // Unique identifier for the trigger
62+
tilebox.v1.ID id = 1; // Unique identifier for the trigger
6263
string schedule = 2; // A cron schedule for the trigger, e.g. "0 0 * * *" (every day at midnight)
6364
}
6465

@@ -79,7 +80,7 @@ enum StorageEventType {
7980

8081
// TriggeredStorageEvent contains the details of the concrete event that triggered a storage event trigger.
8182
message TriggeredStorageEvent {
82-
UUID storage_location_id = 1; // The storage location that triggered the task
83+
tilebox.v1.ID storage_location_id = 1; // The storage location that triggered the task
8384
StorageEventType type = 2; // The type of the storage event, e.g. created
8485
// The object that triggered the task, e.g. a file name in a directory or object name in a bucket
8586
string location = 3;
@@ -93,7 +94,7 @@ message TriggeredCronEvent {
9394
// DeleteAutomationRequest requests the deletion of an automation.
9495
message DeleteAutomationRequest {
9596
// The ID of the automation to delete.
96-
UUID automation_id = 1;
97+
tilebox.v1.ID automation_id = 1;
9798
// Whether to cancel all jobs that have been created by this automation.
9899
bool cancel_jobs = 2;
99100
}
@@ -105,16 +106,16 @@ service AutomationService {
105106
// ListStorageLocations lists all the storage buckets that are available for use as bucket triggers.
106107
rpc ListStorageLocations(google.protobuf.Empty) returns (StorageLocations);
107108
// GetStorageLocation gets a storage location by its ID.
108-
rpc GetStorageLocation(UUID) returns (StorageLocation);
109+
rpc GetStorageLocation(tilebox.v1.ID) returns (StorageLocation);
109110
// CreateStorageLocation creates a new storage bucket.
110111
rpc CreateStorageLocation(StorageLocation) returns (StorageLocation);
111112
// DeleteStorageLocation deletes a storage location.
112-
rpc DeleteStorageLocation(UUID) returns (google.protobuf.Empty);
113+
rpc DeleteStorageLocation(tilebox.v1.ID) returns (google.protobuf.Empty);
113114

114115
// ListAutomations lists all the automations that are currently registered in a namespace.
115116
rpc ListAutomations(google.protobuf.Empty) returns (Automations);
116117
// GetAutomation gets an automation by its ID.
117-
rpc GetAutomation(UUID) returns (AutomationPrototype);
118+
rpc GetAutomation(tilebox.v1.ID) returns (AutomationPrototype);
118119
// CreateAutomation creates a new automation in a namespace.
119120
rpc CreateAutomation(AutomationPrototype) returns (AutomationPrototype);
120121
// UpdateAutomation updates an automation in a namespace.

0 commit comments

Comments
 (0)