github.com/viant/toolbox@v0.34.5/storage/scp/object.go (about)

     1  package scp
     2  
     3  import (
     4  	"github.com/viant/toolbox/storage"
     5  	"os"
     6  )
     7  
     8  type object struct {
     9  	*storage.AbstractObject
    10  	source     interface{}
    11  	permission string
    12  }
    13  
    14  //Wrap wraps source storage object
    15  func (i *object) Wrap(source interface{}) {
    16  	i.source = source
    17  }
    18  
    19  //Unwrap unwraps source storage object into provided target.
    20  func (i *object) Unwrap(target interface{}) error {
    21  	if result, ok := target.(**object); ok {
    22  		*result = i
    23  	}
    24  	return nil
    25  }
    26  
    27  //newObject creates a new gc storage object
    28  func newStorageObject(URL string, source interface{}, fileInfo os.FileInfo) storage.Object {
    29  	abstract := storage.NewAbstractStorageObject(URL, source, fileInfo)
    30  	result := &object{
    31  		AbstractObject: abstract,
    32  	}
    33  	result.AbstractObject.Object = result
    34  	return result
    35  }