Permalink
Browse files

Move api/admin.go into its own package under api/admin/. Add doc stri…

…ngs for all internal packages.
  • Loading branch information...
vlad-alexandru-ionescu committed May 5, 2016
1 parent 7b1d4e1 commit 5f5680caa59591bd071eb30b4a2974aa036b8a36
View
@@ -1,3 +1,5 @@
+// Package admin provides as implementation for Lever OS's admin service. It is
+// used to manage the Lever OS system.
package admin
import (
@@ -1,19 +1,22 @@
-package api
+// Package admin provides convenience function for interacting with the admin
+// service. The admin service is used for managing Lever OS itself.
+package admin
import (
"bufio"
"fmt"
"io"
"os"
+ "github.com/leveros/leveros/api"
"github.com/leveros/leveros/core"
"github.com/leveros/leveros/leverutil"
)
// DeployServiceDir deploys provided dir onto Lever, as a Lever service.
func DeployServiceDir(
adminEnv string, host string, env string, srcDir string) error {
- client, err := NewClient()
+ client, err := api.NewClient()
if err != nil {
return err
}
View
@@ -1,3 +1,5 @@
+// Package apiserver provides a HTTP gateway for invoking Lever methods without
+// the use of a gRPC client.
package apiserver
import (
View
@@ -1,3 +1,4 @@
+// Package main runs the admin service.
package main
import (
View
@@ -1,3 +1,5 @@
+// Package cmd contains main subpackages for the various binaries built as part
+// of Lever OS.
package cmd
// PackageName is the name of this package.
View
@@ -1,3 +1,4 @@
+// Package main initializes Lever OS's database.
package main
import (
@@ -47,17 +48,4 @@ func main() {
logger.WithFields("err", err).Warning(
"Failed to set admin live code version")
}
-
- // TODO: Remove this.
- err = store.NewService(
- as, core.DefaultDevEnvFlag.Get(), "testservice", "A test service", true)
- if err != nil {
- logger.WithFields("err", err).Warning("Failed to create test service")
- }
- err = store.SetServiceLiveCodeVersion(
- as, core.DefaultDevEnvFlag.Get(), "testservice", 1)
- if err != nil {
- logger.WithFields("err", err).Warning(
- "Failed to set test service live code version")
- }
}
View
@@ -10,6 +10,7 @@ import (
"github.com/codegangsta/cli"
leverapi "github.com/leveros/leveros/api"
+ admin "github.com/leveros/leveros/api/admin"
"github.com/leveros/leveros/cmd"
"github.com/leveros/leveros/core"
"github.com/leveros/leveros/leverutil"
@@ -139,7 +140,7 @@ func actionDeploy(ctx *cli.Context) {
if serviceDir == "" {
serviceDir = "."
}
- err := leverapi.DeployServiceDir(
+ err := admin.DeployServiceDir(
adminEnv, host, destEnv, serviceDir)
if err != nil {
logger.WithFields("err", err).Fatal("Error trying to deploy service")
View
@@ -1,3 +1,6 @@
+// Package main runs a Lever OS host. A Lever OS host is the main process in
+// a Lever deployment. It manages traffic through the Lever network and manages
+// Lever instances.
package main
import (
View
@@ -1,3 +1,4 @@
+// Package main uploads a config file to consul.
package main
import (
View
@@ -1,3 +1,5 @@
+// Package config provides configuration flags. These can be configured via
+// command line flags, environment variables or via Consul.
package config
import (
View
@@ -1,3 +1,5 @@
+// Package core provides common utilities to be used throughout various Lever
+// binaries and libraries. These utilities are very specific to Lever.
package core
import (
View
@@ -1,3 +1,5 @@
+// Package devlogger provides an implementation of a syslog server to be used
+// for dev environments.
package devlogger
import (
View
@@ -1,3 +1,5 @@
+// Package dockerutil provides Docker-related utility functions. These are
+// very specific to Lever.
package dockerutil
import (
@@ -1,3 +1,7 @@
+// Package fleettracker provides an implementation of a service that receives
+// live usage metrics of Lever services and automatically adjusts the number
+// of instances for the service. In other words, it provides auto-scaling
+// capabilities to Lever.
package fleettracker
import (
View
@@ -1,3 +1,6 @@
+// Package host contains the core implementation for a Lever OS host. A Lever
+// OS host is the main process in a Lever deployment. It manages traffic through
+// the Lever network and manages Lever instances.
package host
// PackageName is the name of this package.
View
@@ -1,3 +1,6 @@
+// Package hostman provides utilities for managing Lever instances and Lever
+// resources running on the same node. It also provides a service so that
+// the capabilities are accessible to other services as well.
package hostman
// PackageName is the name of this package.
@@ -1,3 +1,5 @@
+// Package http2stream provides an implementation of an HTTP/2 server and
+// client that allows piping streams (useful for creating proxies).
package http2stream
// PackageName is the name of this package.
View
@@ -1,3 +1,5 @@
+// Package leverutil provides general utility functions that are not specific to
+// Lever.
package leverutil
import (
View
@@ -1,3 +1,5 @@
+// Package scale provides utility functions for internal service and resource
+// discovery, management and access.
package scale
// PackageName is the name of this package.
View
@@ -8,6 +8,7 @@ import (
"testing"
"github.com/leveros/leveros/api"
+ "github.com/leveros/leveros/api/admin"
"github.com/leveros/leveros/config"
"github.com/leveros/leveros/core"
"github.com/leveros/leveros/leverutil"
@@ -26,7 +27,7 @@ func TestMain(m *testing.M) {
leverutil.UpdateLoggingSettings()
logger.Info("Deploying...")
- err := api.DeployServiceDir(
+ err := admin.DeployServiceDir(
core.AdminEnvFlag.Get(), core.DefaultDevAliasFlag.Get(),
core.DefaultDevEnvFlag.Get(), serviceName)
if err != nil {

0 comments on commit 5f5680c

Please sign in to comment.