github.com/niedbalski/juju@v0.0.0-20190215020005-8ff100488e47/worker/storageprovisioner/noopfs.go (about)

     1  // Copyright 2018 Canonical Ltd.
     2  // Licensed under the AGPLv3, see LICENCE file for details.
     3  
     4  package storageprovisioner
     5  
     6  import (
     7  	environscontext "github.com/juju/juju/environs/context"
     8  	"github.com/juju/juju/storage"
     9  )
    10  
    11  // noopFilesystemSource is an implementation of storage.FilesystemSource
    12  // that does nothing.
    13  //
    14  // noopFilesystemSource is expected to be called from a single goroutine.
    15  type noopFilesystemSource struct{}
    16  
    17  // ValidateFilesystemParams is defined on storage.FilesystemSource.
    18  func (s *noopFilesystemSource) ValidateFilesystemParams(params storage.FilesystemParams) error {
    19  	return nil
    20  }
    21  
    22  // CreateFilesystems is defined on storage.FilesystemSource.
    23  func (s *noopFilesystemSource) CreateFilesystems(ctx environscontext.ProviderCallContext, args []storage.FilesystemParams) ([]storage.CreateFilesystemsResult, error) {
    24  	return nil, nil
    25  }
    26  
    27  // DestroyFilesystems is defined on storage.FilesystemSource.
    28  func (s *noopFilesystemSource) DestroyFilesystems(ctx environscontext.ProviderCallContext, filesystemIds []string) ([]error, error) {
    29  	return make([]error, len(filesystemIds)), nil
    30  }
    31  
    32  // ReleaseFilesystems is defined on storage.FilesystemSource.
    33  func (s *noopFilesystemSource) ReleaseFilesystems(ctx environscontext.ProviderCallContext, filesystemIds []string) ([]error, error) {
    34  	return make([]error, len(filesystemIds)), nil
    35  }
    36  
    37  // AttachFilesystems is defined on storage.FilesystemSource.
    38  func (s *noopFilesystemSource) AttachFilesystems(ctx environscontext.ProviderCallContext, args []storage.FilesystemAttachmentParams) ([]storage.AttachFilesystemsResult, error) {
    39  	return nil, nil
    40  }
    41  
    42  // DetachFilesystems is defined on storage.FilesystemSource.
    43  func (s *noopFilesystemSource) DetachFilesystems(ctx environscontext.ProviderCallContext, args []storage.FilesystemAttachmentParams) ([]error, error) {
    44  	return make([]error, len(args)), nil
    45  }