// Set upload info for each share.
332805
func (s *shareDBV1) Set(objectURL string, shareURL string, expiry time.Duration, contentType string) {
	s.mutex.Lock()
	defer s.mutex.Unlock()

	s.Shares[shareURL] = shareEntryV1{
		URL:         objectURL,
		Date:        UTCNow(),
		Expiry:      expiry,
		ContentType: contentType,
	}
}
1183095
func (client *SSHClient) Upload(src io.Reader, dst string, size int, mode uint32) error {
	session, err := client.cryptoClient.NewSession()
	if err != nil {
		return err
	}
	defer session.Close()

	w, err := session.StdinPipe()
	if err != nil {
		return err
	}

	errorChan := make(chan error, 2)
	remoteDir := path.Dir(dst)
	remoteFileName := path.Base(dst)

	wg := sync.WaitGroup{}
	wg.Add(2)

	go func() {
		defer w.Close()
		defer wg.Done()

		// Signals to the SSH receiver that content is being passed.
		fmt.Fprintf(w, "C%#o %d %s\n", mode, size, remoteFileName)
		_, err = io.Copy(w, src)
		if err != nil {
			errorChan <- err
			return
		}

		// End SSH transfer
		fmt.Fprint(w, "\x00")
	}()

	go func() {
		defer wg.Done()
		if err := session.Run(fmt.Sprintf("/usr/bin/scp -t %s", remoteDir)); err != nil {
			errorChan <- err
			return
		}
	}()

	wg.Wait()

	select {
	case err := <-errorChan:
		return err
	default:
		break
	}

	return nil
}
108804
func (s *InstallToRemoteAccessSessionOutput) SetAppUpload(v *Upload) *InstallToRemoteAccessSessionOutput {
	s.AppUpload = v
	return s
}
340416
func (lbp *LoadBalancerPerm) SetAll(value bool) {
	lbp.Create = value
	lbp.Delete = value
	lbp.ManageAttachedServerIPs = value
	lbp.ManageRules = value
	lbp.Modify = value
	lbp.SetDescription = value
	lbp.SetName = value
	lbp.Show = value
}
843703
func (s *ListMultipartUploadsInput) SetMaxUploads(v int64) *ListMultipartUploadsInput {
	s.MaxUploads = &v
	return s
}
1269383
func (t *Torrent) setInfoBytes(b []byte) error {
	if metainfo.HashBytes(b) != t.infoHash {
		return errors.New("info bytes have wrong hash")
	}
	var info metainfo.Info
	if err := bencode.Unmarshal(b, &info); err != nil {
		return fmt.Errorf("error unmarshalling info bytes: %s", err)
	}
	if err := t.setInfo(&info); err != nil {
		return err
	}
	t.metadataBytes = b
	t.metadataCompletedChunks = nil
	t.onSetInfo()
	return nil
}
1259236
func (d *RawData) SetInfo(info interface{}, args ...int) Data {
	d.Info = info
	if len(args) > 0 {
		d.SetCode(args[0])
	}
	return d
}
1081192
func (c *Communicator) Upload(dst string, src io.Reader, fi *os.FileInfo) error {
	if fi == nil {
		return c.uploadReader(dst, src)
	}
	return c.uploadFile(dst, src, fi)
}
532764
func SetUploadFiles(sel interface{}, files []string, opts ...QueryOption) Action {
	return QueryAfter(sel, func(ctx context.Context, nodes ...*cdp.Node) error {
		if len(nodes) < 1 {
			return fmt.Errorf("selector `%s` did not return any nodes", sel)
		}

		return dom.SetFileInputFiles(files).WithNodeID(nodes[0].NodeID).Do(ctx)
	}, opts...)
}
222162
func (db *StakeDatabase) SetPoolInfo(blockHash chainhash.Hash, tpi *apitypes.TicketPoolInfo) {
	db.poolInfo.Set(blockHash, tpi)
}
849549
func (s *ListUploadsOutput) SetUploads(v []*Upload) *ListUploadsOutput {
	s.Uploads = v
	return s
}
543739
func (s *SMBFileShareInfo) SetFileShareId(v string) *SMBFileShareInfo {
	s.FileShareId = &v
	return s
}
642043
func (ssp *SharedStoragePerm) SetAll(value bool) {
	ssp.Access = value
	ssp.Create = value
	ssp.Delete = value
	ssp.ManageAttachedServers = value
	ssp.Resize = value
	ssp.SetDescription = value
	ssp.SetName = value
	ssp.Show = value
}
251037
func (client *sshClient) Upload(files map[string][]byte) ([]byte, error) {
	// Establish a single command session
	session, err := client.client.NewSession()
	if err != nil {
		return nil, err
	}
	defer session.Close()

	// Create a goroutine that streams the SCP content
	go func() {
		out, _ := session.StdinPipe()
		defer out.Close()

		for file, content := range files {
			client.logger.Trace("Uploading file to server", "file", file, "bytes", len(content))

			fmt.Fprintln(out, "D0755", 0, filepath.Dir(file))             // Ensure the folder exists
			fmt.Fprintln(out, "C0644", len(content), filepath.Base(file)) // Create the actual file
			out.Write(content)                                            // Stream the data content
			fmt.Fprint(out, "\x00")                                       // Transfer end with \x00
			fmt.Fprintln(out, "E")                                        // Leave directory (simpler)
		}
	}()
	return session.CombinedOutput("/usr/bin/scp -v -tr ./")
}
940980
func (s *StreamInfo) SetFiles(v []*StreamFile) *StreamInfo {
	s.Files = v
	return s
}
901766
func (c *Client) PutFormation(formation *ct.Formation) error {
	if formation.AppID == "" || formation.ReleaseID == "" {
		return errors.New("controller: missing app id and/or release id")
	}
	return c.Put(fmt.Sprintf("/apps/%s/formations/%s", formation.AppID, formation.ReleaseID), formation, formation)
}
760307
func (sb *storageBackend) SetFilesystemInfo(tag names.FilesystemTag, info FilesystemInfo) (err error) {
	defer errors.DeferredAnnotatef(&err, "cannot set info for filesystem %q", tag.Id())

	if info.FilesystemId == "" {
		return errors.New("filesystem ID not set")
	}
	fs, err := sb.Filesystem(tag)
	if err != nil {
		return errors.Trace(err)
	}
	// If the filesystem is volume-backed, the volume must be provisioned
	// and attached first.
	if volumeTag, err := fs.Volume(); err == nil {
		volumeAttachments, err := sb.VolumeAttachments(volumeTag)
		if err != nil {
			return errors.Trace(err)
		}
		var anyAttached bool
		for _, a := range volumeAttachments {
			if _, err := a.Info(); err == nil {
				anyAttached = true
			} else if !errors.IsNotProvisioned(err) {
				return err
			}
		}
		if !anyAttached {
			return errors.Errorf(
				"backing volume %q is not attached",
				volumeTag.Id(),
			)
		}
	} else if errors.Cause(err) != ErrNoBackingVolume {
		return errors.Trace(err)
	}
	buildTxn := func(attempt int) ([]txn.Op, error) {
		if attempt > 0 {
			fs, err = sb.Filesystem(tag)
			if err != nil {
				return nil, errors.Trace(err)
			}
		}
		// If the filesystem has parameters, unset them
		// when we set info for the first time, ensuring
		// that params and info are mutually exclusive.
		var unsetParams bool
		if params, ok := fs.Params(); ok {
			info.Pool = params.Pool
			unsetParams = true
		} else {
			// Ensure immutable properties do not change.
			oldInfo, err := fs.Info()
			if err != nil {
				return nil, err
			}
			if err := validateFilesystemInfoChange(info, oldInfo); err != nil {
				return nil, err
			}
		}
		ops := setFilesystemInfoOps(tag, info, unsetParams)
		return ops, nil
	}
	return sb.mb.db().Run(buildTxn)
}