cn-infra: Index | Files | Directories

package cninfra

import ""

Package cninfra is the parent package for all packages that are parts of the CN-Infra platform - a Golang platform for building cloud-native microservices.

The CN-Infra platform is a modular platform comprising a core and a set of plugins. The core provides lifecycle management for plugins, the plugins provide the functionality of the platform. A plugin can consist of one or more Golang packages. Out of the box, the CN-Infra platform provides reusable plugins for logging, health checks, messaging (e.g. Kafka), a common front-end API and back-end connectivity to various data stores (Etcd, Cassandra, Redis, ...), and REST and gRPC APIs.

The CN-Infra platform can be extended by adding a new platform plugin, for example a new data store client or a message bus adapter. Also, each application built on top of the platform is basically just a set of application-specific plugins.


Package Files



agentPackage agent provides the life-cycle management agent for plugins.
configPackage config contains helper functions for parsing of configuration files.
datasyncPackage datasync defines the datasync API, which abstracts the data transport between app plugins and backend data sources.
datasync/grpcsyncPackage grpcsync implements (in ALPHA VERSION) the gRPC client and server that satisfies the datasync API (see the definition of the service in ../syncbase/msg package).
datasync/kvdbsyncPackage kvdbsync defines a key-value data store client API for unified access among key-value datastore servers.
datasync/kvdbsync/localPackage local implements DB Transactions for the local "in memory" transport.
datasync/msgsyncPackage msgsync propagates protobuf messages to a particular topic.
datasync/restsyncPackage restsync implements (in ALPHA VERSION) the datasync API for the HTTP/REST transport.
datasync/resyncPackage resync implements the mechanism to notify previously registered plugins that the resync procedure needs to start.
datasync/syncbasePackage syncbase defines common structures used in multiple datasync transports.
datasync/syncbase/msgPackage msg contains: - the definition of PROTOBUF structures and gRPC service, - helpers for mapping between PROTOBUF structures & the datasync_api.go.
dbPackage db is the parent package for the Data Broker client implementations for various key-value and SQL data stores.
db/cryptodataPackage cryptodata provides support for wrapping key-value store with crypto layer that will automatically decrypt all data passing through.
db/keyvalPackage keyval provides an abstraction of a key-value data store and defines the keyval data broker API.
db/keyval/etcdPackage etcd implements the key-value Data Broker client API for the etcd key-value data store.
db/keyval/etcd/mocksPackage mocks implements an embedded etcd mock used in unit & integration tests.
db/keyval/kvprotoPackage kvproto provides a wrapper that simplifies the storing and retrieving of proto-modelled data into/from a key-value data store.
db/keyval/redisPackage redis is the implementation of the key-value Data Broker client API for the Redis key-value data store.
db/sqlPackage sql provides an abstraction of a data store that supports an SQL-like query language and defines the SQL data broker API.
db/sql/cassandraPackage cassandra is the implementation of the SQL Data Broker client API for the Cassandra data store.
examplesPackage examples contains examples that demonstrate the usage of various cn-infra components.
examples/bolt-pluginExample demonstrates creating a Bolt plugin
examples/cassandra-libExample application "cassandra-lib" demonstrates the usage of the cassandra library in a plain go program.
examples/configs-pluginExample program "configs-plugin" demonstrates the usage of PluginConfig API.
examples/cryptodata-pluginExample application "cryptodata-plugin" demonstrates the usage of the cryptodata API.
examples/cryptodata-proto-pluginExample application "cryptodata-proto-plugin" demonstrates the usage of the cryptodata API.
examples/datasync-pluginExample application "datasync-plugin" demonstrates the usage of the datasync API.
examples/etcd-libPackage etcdlib contains a collection of examples demonstrating the usage of the etcd library.
examples/etcd-lib/editorExample program "editor" demonstrates CREATE/UPDATE/DELETE operations with etcd library.
examples/etcd-lib/viewExample program "view" shows how to read data from etcd datastore.
examples/etcd-lib/watcherExample program *watcher* shows how to watch for changes in etcd datastore.
examples/flags-libExample program "flags-lib" demonstrates how to register CLI flags and how to display their runtime values.
examples/grpc-pluginPackage grpcplugin contains grpc server & grpc client example.
examples/grpc-plugin/grpc-serverExample demonstrates the use of GRPC plugin API.
examples/kafka-libPackage kafkalib contains multiple examples with the kafka library.
examples/kafka-lib/asyncproducerAsyncproducer is a simple command line tool for sending messages to Kafka using an asynchronous Kafka producer.
examples/kafka-lib/consumerConsumer is a simple command line tool for consuming a Kafka topic and printing the received messages to the stdout.
examples/kafka-lib/muxMux is a simple command line tool demonstrating the usage of Kafka multiplexer API.
examples/kafka-lib/syncproducerSyncproducer is simple command line tool for sending messages to Kafka using a synchronous Kafka producer.
examples/kafka-lib/utilsPackage utils implements various tools used in examples for Kafka library.
examples/kafka-pluginPackage kafkaplugin contains multiple examples with the kafka plugin.
examples/kafka-plugin/hash-partitionerExample "hash-partitioner" demonstrates the use of Kafka plugin API with automatic (hash-based) partitioning.
examples/kafka-plugin/manual-partitionerExample "manual-partitioner" demonstrates the use of Kafka plugin API with a focus on manual partitioning.
examples/kafka-plugin/post-init-consumerExample "later-stage" demonstrates the use partition watcher initialized and used after multiplexer Init()
examples/logs-libPackage logslib contains multiple examples showing how to use the logger library with a focus on switching between the log levels.
examples/logs-lib/basicExample "basic" presents the most commonly used APIs of the logger library.
examples/logs-lib/httpExample "http" demonstrates how to change the log level remotely via REST.
examples/logs-pluginExample "logs-plugin" shows how to use the logger library from a simple plugin.
examples/modelPackage etcdexample explains how to generate Golang structures from protobuf-formatted data.
examples/redis-libPackage redislib contains a collection of examples demonstrating the usage of the redis library.
examples/redis-lib/airportA bit more advanced example demonstrating the redis library API.
examples/redis-lib/airport/modelPackage flight defines protobuf-formatted data as used by the airport example.
examples/redis-lib/simpleA simple example demonstrating the redis library API.
examples/redis-pluginExample demonstrates creating a Redis plugin
examples/simple-agentExample simple-agent shows how easily a set of CN-infra based plugins can be turned into an application.
examples/statuscheck-pluginExample application "statuscheck-plugin" demonstrates the usage of statusCheck plugin etcd-plugin is monitored by StatusCheck plugin and examplePlugin reads the state.
healthPackage health contains plugins for monitoring of the health status of the agent.
health/probePackage probe implements HTTP probes: the K8s readiness and liveliness probe handlers + Prometheus format.
health/statuscheckPackage statuscheck defines the status report API for other CN-Infra plugins and implements the health status aggregator/exporter.
health/statuscheck/pluginstatusmapPackage pluginstatusmap implements specialization of idxmap used to store plugin status by plugin name.
idxmapPackage idxmap defines a mapping structure which supports mapping change notifications and retrieval of items by fields in the value structure.
idxmap/memPackage mem provides in-memory implementation of the mapping with multiple indexes.
infraPackage infra provides Plugin interface and related utilities.
loggingPackage logging defines the logging API.
logging/logmanagerPackage logmanager implements the log manager that allows users to set log levels at run-time via a REST API.
logging/logrusPackage logrus implements the logging API based on the Logrus logger.
messagingPackage messaging is the parent package for implementations of various messaging clients, e.g.
messaging/kafkaPackage kafka implements a client for the Kafka broker.
messaging/kafka/clientPackage client implements the synchronous and asynchronous kafka Producers and the kafka Consumer.
messaging/kafka/muxPackage mux implements the session multiplexer that allows multiple plugins to share a single connection to a Kafka broker.
rpcPackage rpc contains plugins providing RPC-like access.
rpc/grpcPackage grpc implements the GRPC netListener through which plugins can expose their services/API to the outside world.
rpc/prometheusPackage prometheus implements plugin that allows to expose prometheus metrics.
rpc/restPackage rest implements the HTTP server through which plugins can expose their REST APIs to the outside world.
rpc/rest/mockPackage mock implements a mock HTTP server.
servicelabelPackage servicelabel provides support for creating/retrieving an identifier (a service label) for a CN-Infra based app.
utilsPackage utils contains multiple utilities and helper functions.
utils/addrsPackage addrs contains helpers for ip and mac address conversion.
utils/clienttlsPackage clienttls provides tls utilities.
utils/redactPackage redact provides utilities for redacting sensitive data.
utils/runtimeutilsPackage runtimeutils contains utilities for inspecting Go's runtime system.
utils/safeclosePackage safeclose provides utilities for safe closing of I/O resources.
utils/structsPackage structs provides reflection utilities to inspect structures.

Updated 2020-11-18. Refresh now. Tools for package owners.