github.com/paybyphone/terraform@v0.9.5-0.20170613192930-9706042ddd51/terraform/shadow.go (about)

     1  package terraform
     2  
     3  // Shadow is the interface that any "shadow" structures must implement.
     4  //
     5  // A shadow structure is an interface implementation (typically) that
     6  // shadows a real implementation and verifies that the same behavior occurs
     7  // on both. The semantics of this behavior are up to the interface itself.
     8  //
     9  // A shadow NEVER modifies real values or state. It must always be safe to use.
    10  //
    11  // For example, a ResourceProvider shadow ensures that the same operations
    12  // are done on the same resources with the same configurations.
    13  //
    14  // The typical usage of a shadow following this interface is to complete
    15  // the real operations, then call CloseShadow which tells the shadow that
    16  // the real side is done. Then, once the shadow is also complete, call
    17  // ShadowError to find any errors that may have been caught.
    18  type Shadow interface {
    19  	// CloseShadow tells the shadow that the REAL implementation is
    20  	// complete. Therefore, any calls that would block should now return
    21  	// immediately since no more changes will happen to the real side.
    22  	CloseShadow() error
    23  
    24  	// ShadowError returns the errors that the shadow has found.
    25  	// This should be called AFTER CloseShadow and AFTER the shadow is
    26  	// known to be complete (no more calls to it).
    27  	ShadowError() error
    28  }