upload

package module
v0.0.0-...-e01a366 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 8, 2019 License: MIT Imports: 25 Imported by: 0

README

upload

Cloud func that:

  • accepts a multi-part http upload
    • set form value: spec-verion
    • set form pre to a file
    • set form blocks to a list of files
    • optional: set form blocks-order to a list of indices. These must be len(blocks) and unique. Re-maps upload order (block i will be sourced from upload blocks[blocksorder[i]]). Client-side can't modify blocks order because of security restrictions in the browser.
  • creates a firestore entry with unique ID, in collection transitions
  • uploads input data to muskoka-transitions (can be overridden by setting TRANSITIONS_BUCKET env var) bucket (<spec-version>/<spec-config>/<key>/{pre.ssz, block_%d.ssz})
  • emits JSON event to pus-sub (topic: transition/<spec-version>/<spec-config>) with spec-version:string, spec-config:string, key:string, blocks:int

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Upload

func Upload(w http.ResponseWriter, r *http.Request)

Types

type Task

type Task struct {
	Index       int       `firestore:"index"`
	Blocks      int       `firestore:"blocks"`
	SpecVersion string    `firestore:"spec-version"`
	SpecConfig  string    `firestore:"spec-config"`
	Created     time.Time `firestore:"created"`
}

type TaskIndexDoc

type TaskIndexDoc struct {
	NextIndex int `firestore:"next-index"`
}

type TransitionMsg

type TransitionMsg struct {
	Blocks      int    `json:"blocks"`
	SpecVersion string `json:"spec-version"`
	SpecConfig  string `json:"spec-config"`
	Key         string `json:"key"`
}

type UploadResponse

type UploadResponse struct {
	Key string `json:"key"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL