// UploadBinaries will send binaries stored in the source blobstore to
// the target controller.
357535
func UploadBinaries(config UploadBinariesConfig) error {
	if err := config.Validate(); err != nil {
		return errors.Trace(err)
	}
	if err := uploadCharms(config); err != nil {
		return errors.Trace(err)
	}
	if err := uploadTools(config); err != nil {
		return errors.Trace(err)
	}
	if err := uploadResources(config); err != nil {
		return errors.Trace(err)
	}
	return nil
}
51382
func (pl *Payload) EncodeBinary(enc *gob.Encoder) error {
	return enc.Encode(pl)
}
644327
func (m *BackendAddress) MarshalBinary() ([]byte, error) {
	if m == nil {
		return nil, nil
	}
	return swag.WriteJSON(m)
}
559637
func (m *StatusResponseContainerRuntime) MarshalBinary() ([]byte, error) {
	if m == nil {
		return nil, nil
	}
	return swag.WriteJSON(m)
}
846647
func (m *StatusResponseProxy) MarshalBinary() ([]byte, error) {
	if m == nil {
		return nil, nil
	}
	return swag.WriteJSON(m)
}
1112855
func (m *EndpointConfigurationSpec) MarshalBinary() ([]byte, error) {
	if m == nil {
		return nil, nil
	}
	return swag.WriteJSON(m)
}
199537
func (hmac HMAC) MarshalBinary() (data []byte, err error) {
	return hmac.h.MarshalBinary()
}
1039321
func (s Slice) GetBinary() ([]byte, error) {
	if !s.IsBinary() {
		return nil, InvalidTypeError{"Expecting type Binary"}
	}

	h := s.head()
	vpackAssert(h >= 0xc0 && h <= 0xc7)

	lengthSize := uint(h - 0xbf)
	length := readIntegerNonEmpty(s[1:], lengthSize)
	checkOverflow(ValueLength(length))
	return s[1+lengthSize : 1+uint64(lengthSize)+length], nil
}
585028
func (m *EndpointChangeRequest) MarshalBinary() ([]byte, error) {
	if m == nil {
		return nil, nil
	}
	return swag.WriteJSON(m)
}
1166620
func (c *Client) UploadAppBits(file io.Reader, appGUID string) error {
	requestFile, err := ioutil.TempFile("", "requests")

	defer func() {
		requestFile.Close()
		os.Remove(requestFile.Name())
	}()

	writer := multipart.NewWriter(requestFile)
	err = writer.WriteField("resources", "[]")
	if err != nil {
		return errors.Wrapf(err, "Error uploading app %s bits", appGUID)
	}

	part, err := writer.CreateFormFile("application", "application.zip")
	if err != nil {
		return errors.Wrapf(err, "Error uploading app %s bits", appGUID)
	}

	_, err = io.Copy(part, file)
	if err != nil {
		return errors.Wrapf(err, "Error uploading app %s bits, failed to copy all bytes", appGUID)
	}

	err = writer.Close()
	if err != nil {
		return errors.Wrapf(err, "Error uploading app %s bits, failed to close multipart writer", appGUID)
	}

	requestFile.Seek(0, 0)
	fileStats, err := requestFile.Stat()
	if err != nil {
		return errors.Wrapf(err, "Error uploading app %s bits, failed to get temp file stats", appGUID)
	}

	requestURL := fmt.Sprintf("/v2/apps/%s/bits", appGUID)
	r := c.NewRequestWithBody("PUT", requestURL, requestFile)
	req, err := r.toHTTP()
	if err != nil {
		return errors.Wrapf(err, "Error uploading app %s bits", appGUID)
	}

	req.ContentLength = fileStats.Size()
	contentType := fmt.Sprintf("multipart/form-data; boundary=%s", writer.Boundary())
	req.Header.Set("Content-Type", contentType)

	resp, err := c.Do(req)
	if err != nil {
		return errors.Wrapf(err, "Error uploading app %s bits", appGUID)
	}
	if resp.StatusCode != http.StatusCreated {
		return errors.Wrapf(err, "Error uploading app %s bits, response code: %d", appGUID, resp.StatusCode)
	}

	return nil
}
130401
func (m *IdentityEndpoints) MarshalBinary() ([]byte, error) {
	if m == nil {
		return nil, nil
	}
	return swag.WriteJSON(m)
}
896240
func uploadBytes(ctx context.Context, bs blobserver.StatReceiver, bb *Builder, size int64, s []span) *uploadBytesFuture {
	future := newUploadBytesFuture()
	parts := []BytesPart{}
	addBytesParts(ctx, bs, &parts, s, future)

	if err := bb.PopulateParts(size, parts); err != nil {
		future.errc <- err
		return future
	}

	// Hack until perkeep.org/issue/102 is fixed. If we happen to upload
	// the "file" schema before any of its parts arrive, then the indexer
	// can get confused.  So wait on the parts before, and then upload
	// the "file" blob afterwards.
	if bb.Type() == "file" {
		future.errc <- nil
		_, err := future.Get() // may not be nil, if children parts failed
		future = newUploadBytesFuture()
		if err != nil {
			future.errc <- err
			return future
		}
	}

	json := bb.Blob().JSON()
	br := blob.RefFromString(json)
	future.br = br
	go func() {
		_, err := uploadString(ctx, bs, br, json)
		future.errc <- err
	}()
	return future
}
259104
func (m *EndpointIdentifiers) MarshalBinary() ([]byte, error) {
	if m == nil {
		return nil, nil
	}
	return swag.WriteJSON(m)
}
958091
func (s *server) initBinary() error {
	s.network.Handle("InsertTriples", s.handleInsertTriples)
	s.network.Handle("QueryRequest", s.handleQueryRequest)

	return nil
}
78768
func (m *BPFMap) MarshalBinary() ([]byte, error) {
	if m == nil {
		return nil, nil
	}
	return swag.WriteJSON(m)
}
241638
func (r repositoryVerifier) Blobs(ctx context.Context) distribution.BlobStore {
	return blobStoreVerifier{BlobStore: r.Repository.Blobs(ctx)}
}
1102839
func (m *LoadResponse) MarshalBinary() ([]byte, error) {
	if m == nil {
		return nil, nil
	}
	return swag.WriteJSON(m)
}