Skip to content
This repository has been archived by the owner on Mar 23, 2023. It is now read-only.

Commit

Permalink
Add rust native implementation of protobufs
Browse files Browse the repository at this point in the history
Other changes
- Removed enum ProductType declarations in each Product action message (see protos/product_payload.proto)
- Renamed 'product_values' field to 'properties' field for coherency (see protos/product_state.proto)
- Replaced deprecated StdError 'cause' function with new 'source' function (see protocol/product/state.rs)

Signed-off-by: Raphael Santo Domingo <raphael.santodomingo@target.com>
  • Loading branch information
Raphael Santo Domingo committed Jul 19, 2019
1 parent b7ec9a4 commit 8805dcf
Show file tree
Hide file tree
Showing 6 changed files with 1,337 additions and 18 deletions.
20 changes: 4 additions & 16 deletions sdk/protos/product_payload.proto
Original file line number Diff line number Diff line change
Expand Up @@ -37,36 +37,24 @@ message ProductPayload {
}

message ProductCreateAction {
enum ProductType {
UNSET_TYPE = 0;
GS1 = 1;
}
// product_type and identifier are used in deriving the state address
ProductType product_type = 1;
Product.ProductType product_type = 1;
string identifier = 2;
string owner = 3;
repeated PropertyValue properties = 4;
}

message ProductUpdateAction {
enum ProductType {
UNSET_TYPE = 0;
GS1 = 1;
}
// product_type and identifier are used in deriving the state address
ProductType product_type = 1;
Product.ProductType product_type = 1;
string identifier = 2;
// this will replace all properties currently defined
repeated PropertyValue properties = 4;
repeated PropertyValue properties = 3;
}

message ProductDeleteAction {
enum ProductType {
UNSET_TYPE = 0;
GS1 = 1;
}
// product_type and identifier are used in deriving the state address
ProductType product_type = 1;
Product.ProductType product_type = 1;
string identifier = 2;
}

4 changes: 2 additions & 2 deletions sdk/protos/product_state.proto
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ message Product {
string identifier = 1;

// What type of product is this (GS1)
ProductType type = 2;
ProductType product_type = 2;

// Who owns this product (pike organization id)
string owner = 3;

// Addition attributes for custom configurations
repeated PropertyValue product_values = 4;
repeated PropertyValue properties = 4;
}

message ProductList {
Expand Down
1 change: 1 addition & 0 deletions sdk/src/protocol/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,6 @@

pub mod errors;
pub mod pike;
pub mod product;
pub mod schema;
pub mod track_and_trace;
18 changes: 18 additions & 0 deletions sdk/src/protocol/product/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// Copyright (c) 2019 Target Brands, Inc.
//
// 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
//
// http://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.

use super::errors;

pub mod payload;
pub mod state;
Loading

0 comments on commit 8805dcf

Please sign in to comment.