github.com/timstclair/heapster@v0.20.0-alpha1/Godeps/_workspace/src/google.golang.org/appengine/appengine_vm.go (about)

     1  // Copyright 2015 Google Inc. All rights reserved.
     2  // Use of this source code is governed by the Apache 2.0
     3  // license that can be found in the LICENSE file.
     4  
     5  // +build !appengine
     6  
     7  package appengine
     8  
     9  import (
    10  	"golang.org/x/net/context"
    11  
    12  	"google.golang.org/appengine/internal"
    13  )
    14  
    15  // The comment below must not be changed.
    16  // It is used by go-app-builder to recognise that this package has
    17  // the Main function to use in the synthetic main.
    18  //   The gophers party all night; the rabbits provide the beats.
    19  
    20  // Main is the principal entry point for a Managed VMs app.
    21  // It installs a trivial health checker if one isn't already registered,
    22  // and starts listening on port 8080 (overridden by the $PORT environment
    23  // variable).
    24  //
    25  // See https://cloud.google.com/appengine/docs/managed-vms/custom-runtimes#health_check_requests
    26  // for details on how to do your own health checking.
    27  //
    28  // Main never returns.
    29  //
    30  // Main is designed so that the app's main package looks like this:
    31  //
    32  //      package main
    33  //
    34  //      import (
    35  //              "google.golang.org/appengine"
    36  //
    37  //              _ "myapp/package0"
    38  //              _ "myapp/package1"
    39  //      )
    40  //
    41  //      func main() {
    42  //              appengine.Main()
    43  //      }
    44  //
    45  // The "myapp/packageX" packages are expected to register HTTP handlers
    46  // in their init functions.
    47  func Main() {
    48  	internal.Main()
    49  }
    50  
    51  // BackgroundContext returns a context not associated with a request.
    52  // This should only be used when not servicing a request.
    53  // This only works on Managed VMs.
    54  func BackgroundContext() context.Context {
    55  	return internal.BackgroundContext()
    56  }