github.com/bdwilliams/libcompose@v0.3.1-0.20160826154243-d81a9bdacff0/project/empty.go (about)

     1  package project
     2  
     3  import (
     4  	"golang.org/x/net/context"
     5  
     6  	"github.com/docker/libcompose/config"
     7  	"github.com/docker/libcompose/project/events"
     8  	"github.com/docker/libcompose/project/options"
     9  )
    10  
    11  // this ensures EmptyService implements Service
    12  // useful since it's easy to forget adding new functions to EmptyService
    13  var _ Service = (*EmptyService)(nil)
    14  
    15  // EmptyService is a struct that implements Service but does nothing.
    16  type EmptyService struct {
    17  }
    18  
    19  // Create implements Service.Create but does nothing.
    20  func (e *EmptyService) Create(ctx context.Context, options options.Create) error {
    21  	return nil
    22  }
    23  
    24  // Build implements Service.Build but does nothing.
    25  func (e *EmptyService) Build(ctx context.Context, buildOptions options.Build) error {
    26  	return nil
    27  }
    28  
    29  // Up implements Service.Up but does nothing.
    30  func (e *EmptyService) Up(ctx context.Context, options options.Up) error {
    31  	return nil
    32  }
    33  
    34  // Start implements Service.Start but does nothing.
    35  func (e *EmptyService) Start(ctx context.Context) error {
    36  	return nil
    37  }
    38  
    39  // Stop implements Service.Stop() but does nothing.
    40  func (e *EmptyService) Stop(ctx context.Context, timeout int) error {
    41  	return nil
    42  }
    43  
    44  // Delete implements Service.Delete but does nothing.
    45  func (e *EmptyService) Delete(ctx context.Context, options options.Delete) error {
    46  	return nil
    47  }
    48  
    49  // Restart implements Service.Restart but does nothing.
    50  func (e *EmptyService) Restart(ctx context.Context, timeout int) error {
    51  	return nil
    52  }
    53  
    54  // Log implements Service.Log but does nothing.
    55  func (e *EmptyService) Log(ctx context.Context, follow bool) error {
    56  	return nil
    57  }
    58  
    59  // Pull implements Service.Pull but does nothing.
    60  func (e *EmptyService) Pull(ctx context.Context) error {
    61  	return nil
    62  }
    63  
    64  // Kill implements Service.Kill but does nothing.
    65  func (e *EmptyService) Kill(ctx context.Context, signal string) error {
    66  	return nil
    67  }
    68  
    69  // Containers implements Service.Containers but does nothing.
    70  func (e *EmptyService) Containers(ctx context.Context) ([]Container, error) {
    71  	return []Container{}, nil
    72  }
    73  
    74  // Scale implements Service.Scale but does nothing.
    75  func (e *EmptyService) Scale(ctx context.Context, count int, timeout int) error {
    76  	return nil
    77  }
    78  
    79  // Info implements Service.Info but does nothing.
    80  func (e *EmptyService) Info(ctx context.Context) (InfoSet, error) {
    81  	return InfoSet{}, nil
    82  }
    83  
    84  // Pause implements Service.Pause but does nothing.
    85  func (e *EmptyService) Pause(ctx context.Context) error {
    86  	return nil
    87  }
    88  
    89  // Unpause implements Service.Pause but does nothing.
    90  func (e *EmptyService) Unpause(ctx context.Context) error {
    91  	return nil
    92  }
    93  
    94  // Run implements Service.Run but does nothing.
    95  func (e *EmptyService) Run(ctx context.Context, commandParts []string, options options.Run) (int, error) {
    96  	return 0, nil
    97  }
    98  
    99  // RemoveImage implements Service.RemoveImage but does nothing.
   100  func (e *EmptyService) RemoveImage(ctx context.Context, imageType options.ImageType) error {
   101  	return nil
   102  }
   103  
   104  // Events implements Service.Events but does nothing.
   105  func (e *EmptyService) Events(ctx context.Context, events chan events.ContainerEvent) error {
   106  	return nil
   107  }
   108  
   109  // DependentServices implements Service.DependentServices with empty slice.
   110  func (e *EmptyService) DependentServices() []ServiceRelationship {
   111  	return []ServiceRelationship{}
   112  }
   113  
   114  // Config implements Service.Config with empty config.
   115  func (e *EmptyService) Config() *config.ServiceConfig {
   116  	return &config.ServiceConfig{}
   117  }
   118  
   119  // Name implements Service.Name with empty name.
   120  func (e *EmptyService) Name() string {
   121  	return ""
   122  }
   123  
   124  // this ensures EmptyNetworks implements Networks
   125  var _ Networks = (*EmptyNetworks)(nil)
   126  
   127  // EmptyNetworks is a struct that implements Networks but does nothing.
   128  type EmptyNetworks struct {
   129  }
   130  
   131  // Initialize implements Networks.Initialize but does nothing.
   132  func (e *EmptyNetworks) Initialize(ctx context.Context) error {
   133  	return nil
   134  }
   135  
   136  // Remove implements Networks.Remove but does nothing.
   137  func (e *EmptyNetworks) Remove(ctx context.Context) error {
   138  	return nil
   139  }