google.golang.org/appengine/blobstore 패키지(v1.6.8)

blobstore 패키지는 App Engine의 영구 blob 저장소 서비스를 위한 클라이언트를 제공합니다.

함수

func BlobKeyForFile

func BlobKeyForFile(c context.Context, filename string) (appengine.BlobKey, error)

BlobKeyForFile은 Google Storage 파일에 대한 BlobKey를 반환합니다. 파일 이름은 '/gs/bucket_name/object_name' 형식이어야 합니다.

func Delete

func Delete(c context.Context, blobKey appengine.BlobKey) error

Delete는 blob을 삭제합니다.

func DeleteMulti

func DeleteMulti(c context.Context, blobKey []appengine.BlobKey) error

DeleteMulti는 여러 blob을 삭제합니다.

func ParseUpload

func ParseUpload(req *http.Request) (blobs map[string][]*BlobInfo, other url.Values, err error)

사용자가 blob을 성공적으로 업로드하면 ParseUpload는 앱이 App Engine에서 가져오는 합성 POST 요청을 파싱합니다. 요청이 지정되면 ParseUpload는 수신한 blob의 맵(HTML 양식 요소 이름으로 입력)과 다른 blob가 아닌 POST 매개변수를 반환합니다.

func Send

func Send(response http.ResponseWriter, blobKey appengine.BlobKey)

Send는 응답 시 헤더를 설정하여 App Engine에 응답 본문으로 blob을 전송하도록 지시합니다. 수동으로 읽고 쓰는 것보다는 이 방법이 더욱 효율적이며 일반적인 응답 크기 제한도 적용되지 않습니다.

func UploadURL

func UploadURL(c context.Context, successPath string, opts *UploadURLOptions) (*url.URL, error)

UploadURL은 사용자가 작성하는 양식의 업로드 URL을 만들고 양식의 POST가 완료되면 로드할 애플리케이션 경로를 전달합니다. 이러한 URL은 만료되며 다시 사용되지 않아야 합니다. opts 매개변수는 nil일 수 있습니다.

BlobInfo

type BlobInfo struct {
	BlobKey      appengine.BlobKey
	ContentType  string    `datastore:"content_type"`
	CreationTime time.Time `datastore:"creation"`
	Filename     string    `datastore:"filename"`
	Size         int64     `datastore:"size"`
	MD5          string    `datastore:"md5_hash"`

	// ObjectName is the Google Cloud Storage name for this blob.
	ObjectName string `datastore:"gs_object_name"`
}

BlobInfo는 데이터 저장소에 저장되는 blob 메타데이터입니다. 파일 이름은 비어 있을 수 있습니다.

func Stat

func Stat(c context.Context, blobKey appengine.BlobKey) (*BlobInfo, error)

Stat은 제공된 blobKey의 BlobInfo를 반환합니다. 해당 키의 blob이 발견되지 않으면 Stat은 datastore.ErrNoSuchEntity를 반환합니다.

리더

type Reader interface {
	io.Reader
	io.ReaderAt
	io.Seeker
}

Reader는 blob 리더입니다.

func NewReader

func NewReader(c context.Context, blobKey appengine.BlobKey) Reader

NewReader는 blob의 리더를 반환합니다. 항상 성공합니다. 하지만 blob이 없으면 처음 읽을 때 오류가 보고됩니다.

UploadURLOptions

type UploadURLOptions struct {
	MaxUploadBytes        int64 // optional
	MaxUploadBytesPerBlob int64 // optional

	// StorageBucket specifies the Google Cloud Storage bucket in which
	// to store the blob.
	// This is required if you use Cloud Storage instead of Blobstore.
	// Your application must have permission to write to the bucket.
	// You may optionally specify a bucket name and path in the format
	// "bucket_name/path", in which case the included path will be the
	// prefix of the uploaded object's name.
	StorageBucket string
}

UploadURLOptions는 업로드 URL을 만들기 위한 옵션입니다.