Skip to content

Commit 939adb3

Browse files
committed
Merge branch 'main' into sync_by_region
2 parents f94aee6 + 59053e3 commit 939adb3

34 files changed

Lines changed: 410 additions & 129 deletions

ReadMe.md

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,24 +9,37 @@
99
[![PkgGoDev](https://img.shields.io/badge/go.dev-docs-007d9c?logo=go&logoColor=white&style=flat-square)](https://pkg.go.dev/github.com/trimble-oss/tierceron-core)
1010

1111
## What is it?
12-
Tierceron-core is an interface definition project in support of the tierceron hive. It provides a list of supported events emitted by the hive kernel.
12+
Tierceron-core is the shared Go module for Tierceron runtime, transport, and flow plumbing. It packages the reusable APIs, plugin coordination types, filesystem abstractions, statistics protobufs, and utility layers that higher-level Tierceron services import.
1313

14-
## Why❓
15-
Tierceron hive utilizes trcsh to run as a service that
16-
delivers secrets securely to running [go plugin](https://pkg.go.dev/plugin) implementation of microservices.
14+
## What is in this repo?
15+
- `api`: REST, gRPC, and SOAP client support, endpoint definitions, TLS configuration, retry handling, and example code.
16+
- `core`: plugin event types, chat and command channels, configuration context, data-flow statistics, plugin synchronization, and core configuration helpers.
17+
- `flow`: the flow processing framework for initializing and running Tierceron data pipelines.
18+
- `statsdk`: generated protobuf and gRPC definitions for statistics exchange.
19+
- `trcshfs`: shell-facing filesystem abstractions and `trcshio` helpers.
20+
- `bitlock`, `util`, and `util/mlock`: shared locking and utility helpers.
21+
- `atrium`, `buildopts`, `prod`, and `shell`: build options and runtime support packages used by dependent Tierceron components.
1722

1823
## Key Features
19-
* Configurations delivered in memory from vault to trcsh kernel directly to running tierceron plugin services via an
20-
* Kernel services can be remotely managed via trcsh scripts running in a release pipeline. These scripts require authentication in order to run
24+
- Multi-protocol API caller support for REST, gRPC, and SOAP integrations.
25+
- Shared kernel types for plugin lifecycle, chat exchange, command routing, and data-flow statistics.
26+
- Flow orchestration primitives for building reusable processing pipelines.
27+
- Shared protobuf and filesystem packages used across Tierceron services.
2128

2229

2330
## Getting started
24-
If you are a contributor, please have a look on the [getting started](GETTING_STARTED.MD) file. Here you can check the information required and other things before providing a useful contribution.
31+
To work on the module locally:
32+
33+
- Run `go test ./...` from the repository root.
34+
- See [api/README.md](api/README.md) for the standalone API caller package documentation.
35+
- See [api/TLS_USAGE.md](api/TLS_USAGE.md) for certificate and TLS configuration details.
36+
- Contributors should start with [GETTING_STARTED.MD](GETTING_STARTED.MD).
2537

2638
## Trusted Committers
2739
- [Joel Rieke](mailto:joel_rieke@trimble.com)
2840
- [David Mkrtychyan](mailto:david_mkrtychyan@trimble.com)
2941
- [Karnveer Gill](mailto:karnveer_gill@trimble.com)
42+
- [Meghan Bailey](mailto:meghan_bailey@trimble.com)
3043

3144
## Contributing
3245
Contributions are always welcome, no matter how large or small. Before contributing, please read the [code of conduct](CODE_OF_CONDUCT.MD).
@@ -36,5 +49,5 @@ See [Contributing](CONTRIBUTING.MD).
3649
## Code review
3750
Check the [code review](CODE_REVIEW.MD) information to find out how a **Pull Request** is evaluated for this project and what other coding standards you should consider when you want to contribute.
3851

39-
## Current effort
40-
Titrating. Tierceron can do a lot of things. Some features are very easy to set up and use, others not so much. Contributions welcomed!
52+
## Security
53+
Please review [SECURITY.md](SECURITY.md) for vulnerability reporting guidance.

SECURITY.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
## Reporting a Vulnerability
44

5-
Report security vulnerabilities by emailing the Trimble Cybersecurity team at:
5+
Report security vulnerabilities to the Trimble Cybersecurity team at:
66

7-
cybersecurity@trimble.com
7+
<https://www.trimble.com/en/our-commitment/responsible-business/data-privacy-and-security/report-cybersecurity-issues/form>
88

99
Report security vulnerabilities in third-party modules to the person or team maintaining the module.
1010

api/api.go

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -159,14 +159,8 @@ func (e *Endpoint) Call(params map[string]any) (map[string]any, error) {
159159
// Make the call with retry logic for timeouts
160160
var response *Response
161161
var callErr error
162-
maxRetries := e.MaxRetries
163-
if maxRetries < 0 {
164-
maxRetries = 0
165-
}
166-
retryErrRange := e.RetryErrorRange
167-
if retryErrRange < 0 {
168-
retryErrRange = 0
169-
}
162+
maxRetries := max(e.MaxRetries, 0)
163+
retryErrRange := max(e.RetryErrorRange, 0)
170164

171165
for attempt := 0; attempt <= maxRetries; attempt++ {
172166
// Recreate context for each retry attempt

api/demo/main.go

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ func main() {
7676
Timeout: 10 * time.Second,
7777
}
7878

79-
params := map[string]interface{}{
79+
params := map[string]any{
8080
"method": "GET",
8181
"headers": map[string]string{
8282
"Accept": "application/json",
@@ -101,12 +101,12 @@ func main() {
101101
Timeout: 15 * time.Second,
102102
}
103103

104-
postParams := map[string]interface{}{
104+
postParams := map[string]any{
105105
"method": "POST",
106106
"headers": map[string]string{
107107
"Content-Type": "application/json",
108108
},
109-
"body": map[string]interface{}{
109+
"body": map[string]any{
110110
"name": "John Doe",
111111
"email": "john@example.com",
112112
"message": "Hello from API caller!",
@@ -118,7 +118,7 @@ func main() {
118118
log.Printf("REST POST Error: %v\n", err)
119119
} else {
120120
fmt.Printf("Status: %d\n", postResult["statusCode"])
121-
if body, ok := postResult["body"].(map[string]interface{}); ok {
121+
if body, ok := postResult["body"].(map[string]any); ok {
122122
if json, ok := body["json"]; ok {
123123
fmt.Printf("Echoed JSON: %v\n", json)
124124
}
@@ -170,31 +170,31 @@ func main() {
170170
wsdl string
171171
method string
172172
action string
173-
params map[string]interface{}
173+
params map[string]any
174174
}{
175175
{
176176
name: "W3Schools Temperature Converter",
177177
url: "https://www.w3schools.com/xml/tempconvert.asmx",
178178
wsdl: "https://www.w3schools.com/xml/tempconvert.asmx?WSDL",
179179
method: "CelsiusToFahrenheit",
180180
action: "https://www.w3schools.com/xml/CelsiusToFahrenheit",
181-
params: map[string]interface{}{"Celsius": "100"},
181+
params: map[string]any{"Celsius": "100"},
182182
},
183183
{
184184
name: "DNEOnline Calculator",
185185
url: "http://www.dneonline.com/calculator.asmx",
186186
wsdl: "http://www.dneonline.com/calculator.asmx?WSDL",
187187
method: "Add",
188188
action: "http://tempuri.org/Add",
189-
params: map[string]interface{}{"intA": "25", "intB": "17"},
189+
params: map[string]any{"intA": "25", "intB": "17"},
190190
},
191191
{
192192
name: "Thomas Bayer Blz Service",
193193
url: "http://www.thomas-bayer.com/axis2/services/BLZService",
194194
wsdl: "http://www.thomas-bayer.com/axis2/services/BLZService?wsdl",
195195
method: "getBank",
196196
action: "",
197-
params: map[string]interface{}{"blz": "66050000"},
197+
params: map[string]any{"blz": "66050000"},
198198
},
199199
}
200200

@@ -210,7 +210,7 @@ func main() {
210210
WSDLUrl: soapTest.wsdl,
211211
}
212212

213-
soapParams := map[string]interface{}{
213+
soapParams := map[string]any{
214214
"method": soapTest.method,
215215
"soapAction": soapTest.action,
216216
"body": soapTest.params,
@@ -223,7 +223,7 @@ func main() {
223223
fmt.Printf("✓ SOAP call succeeded!\n")
224224
fmt.Printf("Status: %d\n", statusCode)
225225

226-
if body, ok := soapResult["body"].(map[string]interface{}); ok {
226+
if body, ok := soapResult["body"].(map[string]any); ok {
227227
fmt.Printf("Parsed SOAP Response (key-value pairs):\n")
228228
for key, value := range body {
229229
fmt.Printf(" %s: %v\n", key, value)
@@ -260,8 +260,8 @@ func main() {
260260
}
261261

262262
// Simple parameter map - automatically converted to protobuf
263-
grpcParams := map[string]interface{}{
264-
"body": map[string]interface{}{
263+
grpcParams := map[string]any{
264+
"body": map[string]any{
265265
"user_id": "12345",
266266
},
267267
}
@@ -273,7 +273,7 @@ func main() {
273273
} else {
274274
fmt.Printf("Status: %d\n", grpcResult["statusCode"])
275275
// Body is automatically parsed from protobuf to map!
276-
if body, ok := grpcResult["body"].(map[string]interface{}); ok {
276+
if body, ok := grpcResult["body"].(map[string]any); ok {
277277
fmt.Printf("Parsed gRPC Response:\n")
278278
for key, value := range body {
279279
fmt.Printf(" %s: %v\n", key, value)
@@ -292,7 +292,7 @@ func main() {
292292
MaxRetries: 2, // Retry up to 2 times on timeout
293293
}
294294

295-
retryParams := map[string]interface{}{
295+
retryParams := map[string]any{
296296
"method": "GET",
297297
"headers": map[string]string{
298298
"Accept": "application/json",
@@ -363,43 +363,43 @@ func registerTestService(server *grpc.Server) error {
363363
// Create a simple service descriptor programmatically
364364
// This creates a UserService with a GetUser method
365365
fileDesc := &descriptorpb.FileDescriptorProto{
366-
Name: proto.String("user.proto"),
367-
Package: proto.String("user"),
366+
Name: new("user.proto"),
367+
Package: new("user"),
368368
MessageType: []*descriptorpb.DescriptorProto{
369369
{
370-
Name: proto.String("GetUserRequest"),
370+
Name: new("GetUserRequest"),
371371
Field: []*descriptorpb.FieldDescriptorProto{
372372
{
373-
Name: proto.String("user_id"),
373+
Name: new("user_id"),
374374
Number: proto.Int32(1),
375375
Type: descriptorpb.FieldDescriptorProto_TYPE_STRING.Enum(),
376376
Label: descriptorpb.FieldDescriptorProto_LABEL_OPTIONAL.Enum(),
377377
},
378378
},
379379
},
380380
{
381-
Name: proto.String("GetUserResponse"),
381+
Name: new("GetUserResponse"),
382382
Field: []*descriptorpb.FieldDescriptorProto{
383383
{
384-
Name: proto.String("user_id"),
384+
Name: new("user_id"),
385385
Number: proto.Int32(1),
386386
Type: descriptorpb.FieldDescriptorProto_TYPE_STRING.Enum(),
387387
Label: descriptorpb.FieldDescriptorProto_LABEL_OPTIONAL.Enum(),
388388
},
389389
{
390-
Name: proto.String("name"),
390+
Name: new("name"),
391391
Number: proto.Int32(2),
392392
Type: descriptorpb.FieldDescriptorProto_TYPE_STRING.Enum(),
393393
Label: descriptorpb.FieldDescriptorProto_LABEL_OPTIONAL.Enum(),
394394
},
395395
{
396-
Name: proto.String("email"),
396+
Name: new("email"),
397397
Number: proto.Int32(3),
398398
Type: descriptorpb.FieldDescriptorProto_TYPE_STRING.Enum(),
399399
Label: descriptorpb.FieldDescriptorProto_LABEL_OPTIONAL.Enum(),
400400
},
401401
{
402-
Name: proto.String("message"),
402+
Name: new("message"),
403403
Number: proto.Int32(4),
404404
Type: descriptorpb.FieldDescriptorProto_TYPE_STRING.Enum(),
405405
Label: descriptorpb.FieldDescriptorProto_LABEL_OPTIONAL.Enum(),
@@ -409,12 +409,12 @@ func registerTestService(server *grpc.Server) error {
409409
},
410410
Service: []*descriptorpb.ServiceDescriptorProto{
411411
{
412-
Name: proto.String("UserService"),
412+
Name: new("UserService"),
413413
Method: []*descriptorpb.MethodDescriptorProto{
414414
{
415-
Name: proto.String("GetUser"),
416-
InputType: proto.String(".user.GetUserRequest"),
417-
OutputType: proto.String(".user.GetUserResponse"),
415+
Name: new("GetUser"),
416+
InputType: new(".user.GetUserRequest"),
417+
OutputType: new(".user.GetUserResponse"),
418418
},
419419
},
420420
},
@@ -449,7 +449,7 @@ func registerTestService(server *grpc.Server) error {
449449
methodDesc := methods.Get(0)
450450

451451
// Create a handler for the method
452-
handler := func(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
452+
handler := func(srv any, ctx context.Context, dec func(any) error, interceptor grpc.UnaryServerInterceptor) (any, error) {
453453
// Create a dynamic request message
454454
reqMsg := dynamicpb.NewMessage(methodDesc.Input())
455455
if err := dec(reqMsg); err != nil {
@@ -479,7 +479,7 @@ func registerTestService(server *grpc.Server) error {
479479
// Register the service and handler
480480
serviceInfo := &grpc.ServiceDesc{
481481
ServiceName: string(serviceDesc.FullName()),
482-
HandlerType: (*interface{})(nil),
482+
HandlerType: (*any)(nil),
483483
Methods: []grpc.MethodDesc{
484484
{
485485
MethodName: string(methodDesc.Name()),

api/grpc_test.go

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -123,43 +123,43 @@ func startTestGRPCServer() (*grpc.Server, string, error) {
123123
func registerTestUserService(server *grpc.Server) error {
124124
// Create service descriptor
125125
fileDesc := &descriptorpb.FileDescriptorProto{
126-
Name: proto.String("user.proto"),
127-
Package: proto.String("user"),
126+
Name: new("user.proto"),
127+
Package: new("user"),
128128
MessageType: []*descriptorpb.DescriptorProto{
129129
{
130-
Name: proto.String("GetUserRequest"),
130+
Name: new("GetUserRequest"),
131131
Field: []*descriptorpb.FieldDescriptorProto{
132132
{
133-
Name: proto.String("user_id"),
133+
Name: new("user_id"),
134134
Number: proto.Int32(1),
135135
Type: descriptorpb.FieldDescriptorProto_TYPE_STRING.Enum(),
136136
Label: descriptorpb.FieldDescriptorProto_LABEL_OPTIONAL.Enum(),
137137
},
138138
},
139139
},
140140
{
141-
Name: proto.String("GetUserResponse"),
141+
Name: new("GetUserResponse"),
142142
Field: []*descriptorpb.FieldDescriptorProto{
143143
{
144-
Name: proto.String("user_id"),
144+
Name: new("user_id"),
145145
Number: proto.Int32(1),
146146
Type: descriptorpb.FieldDescriptorProto_TYPE_STRING.Enum(),
147147
Label: descriptorpb.FieldDescriptorProto_LABEL_OPTIONAL.Enum(),
148148
},
149149
{
150-
Name: proto.String("name"),
150+
Name: new("name"),
151151
Number: proto.Int32(2),
152152
Type: descriptorpb.FieldDescriptorProto_TYPE_STRING.Enum(),
153153
Label: descriptorpb.FieldDescriptorProto_LABEL_OPTIONAL.Enum(),
154154
},
155155
{
156-
Name: proto.String("email"),
156+
Name: new("email"),
157157
Number: proto.Int32(3),
158158
Type: descriptorpb.FieldDescriptorProto_TYPE_STRING.Enum(),
159159
Label: descriptorpb.FieldDescriptorProto_LABEL_OPTIONAL.Enum(),
160160
},
161161
{
162-
Name: proto.String("message"),
162+
Name: new("message"),
163163
Number: proto.Int32(4),
164164
Type: descriptorpb.FieldDescriptorProto_TYPE_STRING.Enum(),
165165
Label: descriptorpb.FieldDescriptorProto_LABEL_OPTIONAL.Enum(),
@@ -169,12 +169,12 @@ func registerTestUserService(server *grpc.Server) error {
169169
},
170170
Service: []*descriptorpb.ServiceDescriptorProto{
171171
{
172-
Name: proto.String("UserService"),
172+
Name: new("UserService"),
173173
Method: []*descriptorpb.MethodDescriptorProto{
174174
{
175-
Name: proto.String("GetUser"),
176-
InputType: proto.String(".user.GetUserRequest"),
177-
OutputType: proto.String(".user.GetUserResponse"),
175+
Name: new("GetUser"),
176+
InputType: new(".user.GetUserRequest"),
177+
OutputType: new(".user.GetUserResponse"),
178178
},
179179
},
180180
},

api/rest_client.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"encoding/json"
88
"fmt"
99
"io"
10+
"maps"
1011
"net/http"
1112
"net/url"
1213
"strings"
@@ -160,9 +161,7 @@ func encodeFormBody(body any) (io.Reader, error) {
160161
return strings.NewReader(values.Encode()), nil
161162
case map[string][]string:
162163
values := url.Values{}
163-
for key, value := range v {
164-
values[key] = value
165-
}
164+
maps.Copy(values, v)
166165
return strings.NewReader(values.Encode()), nil
167166
case map[string]any:
168167
values := url.Values{}

0 commit comments

Comments
 (0)