treewide: introduce osbase package and move things around
All except localregistry moved from metropolis/pkg to osbase,
localregistry moved to metropolis/test as its only used there anyway.
Change-Id: If1a4bf377364bef0ac23169e1b90379c71b06d72
Reviewed-on: https://review.monogon.dev/c/monogon/+/3079
Tested-by: Jenkins CI
Reviewed-by: Serge Bazanski <serge@monogon.tech>
diff --git a/osbase/logtree/proto/BUILD.bazel b/osbase/logtree/proto/BUILD.bazel
new file mode 100644
index 0000000..92381f1
--- /dev/null
+++ b/osbase/logtree/proto/BUILD.bazel
@@ -0,0 +1,24 @@
+load("@rules_proto//proto:defs.bzl", "proto_library")
+load("@io_bazel_rules_go//go:def.bzl", "go_library")
+load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
+
+proto_library(
+ name = "proto_proto",
+ srcs = ["logtree.proto"],
+ visibility = ["//visibility:public"],
+ deps = ["@com_google_protobuf//:timestamp_proto"],
+)
+
+go_proto_library(
+ name = "proto_go_proto",
+ importpath = "source.monogon.dev/osbase/logtree/proto",
+ proto = ":proto_proto",
+ visibility = ["//visibility:public"],
+)
+
+go_library(
+ name = "proto",
+ embed = [":proto_go_proto"],
+ importpath = "source.monogon.dev/osbase/logtree/proto",
+ visibility = ["//visibility:public"],
+)
diff --git a/osbase/logtree/proto/gomod-generated-placeholder.go b/osbase/logtree/proto/gomod-generated-placeholder.go
new file mode 100644
index 0000000..92256db
--- /dev/null
+++ b/osbase/logtree/proto/gomod-generated-placeholder.go
@@ -0,0 +1 @@
+package proto
diff --git a/osbase/logtree/proto/logtree.proto b/osbase/logtree/proto/logtree.proto
new file mode 100644
index 0000000..bf341d4
--- /dev/null
+++ b/osbase/logtree/proto/logtree.proto
@@ -0,0 +1,59 @@
+// Copyright 2020 The Monogon Project Authors.
+//
+// SPDX-License-Identifier: Apache-2.0
+//
+// 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.
+
+syntax = "proto3";
+package osbase.pkg.logtree.proto;
+option go_package = "source.monogon.dev/osbase/logtree/proto";
+
+import "google/protobuf/timestamp.proto";
+
+// Severity level corresponding to //osbase/logtree.Severity.
+enum LeveledLogSeverity {
+ INVALID = 0;
+ INFO = 1;
+ WARNING = 2;
+ ERROR = 3;
+ FATAL = 4;
+}
+
+// LogEntry corresponding to logtree.LogEntry in //osbase/logtree.
+message LogEntry {
+ // A leveled log entry emitted from a compatible system, eg. Metorpolis code
+ // or a klog-parsed line.
+ message Leveled {
+ repeated string lines = 1;
+ google.protobuf.Timestamp timestamp = 2;
+ LeveledLogSeverity severity = 3;
+ // Source of the error, expressed as file:line.
+ string location = 4;
+ }
+ // Raw log entry, captured from an external system without parting. Might
+ // contain some timestamp/level/origin information embedded in data. Data
+ // contained within should be treated as unsanitized external data.
+ message Raw {
+ string data = 1;
+ // Original length of line, set if data was truncated.
+ int64 original_length = 2;
+ }
+
+ // Origin DN (Distinguished Name), a unique identifier which is provided by
+ // the supervisor system.
+ string dn = 1;
+ oneof kind {
+ Leveled leveled = 2;
+ Raw raw = 3;
+ }
+}