// public trade update just looks like a trade
517345
func NewTradeExecutionUpdateFromRaw(raw []interface{}) (o *TradeExecutionUpdate, err error) {
	if len(raw) == 4 {
		o = &TradeExecutionUpdate{
			ID:         i64ValOrZero(raw[0]),
			MTS:        i64ValOrZero(raw[1]),
			ExecAmount: f64ValOrZero(raw[2]),
			ExecPrice:  f64ValOrZero(raw[3]),
		}
		return
	}
	if len(raw) == 11 {
		o = &TradeExecutionUpdate{
			ID:          i64ValOrZero(raw[0]),
			Pair:        sValOrEmpty(raw[1]),
			MTS:         i64ValOrZero(raw[2]),
			OrderID:     i64ValOrZero(raw[3]),
			ExecAmount:  f64ValOrZero(raw[4]),
			ExecPrice:   f64ValOrZero(raw[5]),
			OrderType:   sValOrEmpty(raw[6]),
			OrderPrice:  f64ValOrZero(raw[7]),
			Maker:       iValOrZero(raw[8]),
			Fee:         f64ValOrZero(raw[9]),
			FeeCurrency: sValOrEmpty(raw[10]),
		}
		return
	}
	return o, fmt.Errorf("data slice too short for trade update: %#v", raw)
}
922581
func (ac *APIController) PolicyUpdate(policy, params *contivModel.Policy) error {
	log.Infof("Received PolicyUpdate: %+v, params: %+v", policy, params)
	return nil
}
61944
func (g *StandardGaugeFloat64) Update(v float64) {
	g.mutex.Lock()
	defer g.mutex.Unlock()
	g.value = v
}
1232946
func (b *Brokers) Update(broker *Broker) {
	if broker == nil {
		log.Warning("Brokers.Update received a nil broker, ignoring")
		return
	}

	b.lock.Lock()
	defer b.lock.Unlock()

	oldBroker := b.brokers[broker.ID]
	// if the broker with given id does not yet exist or changed location - update it, otherwise do nothing
	if oldBroker == nil || oldBroker.broker.Host != broker.Host || oldBroker.broker.Port != broker.Port {
		b.brokers[broker.ID] = NewBrokerConnection(broker, b.keepAliveTimeout)
		return
	}
}
1144328
func (this *NotifyNotification) Update(summary, body, icon string) bool {
	return NotificationUpdate(this, summary, body, icon)
}
963599
func (d *DebugUpgrader) Upgrade(conn io.ReadWriter) (hs ws.Handshake, err error) {
	var (
		// Take the Reader and Writer partst from conn to be probably replaced
		// below.
		r io.Reader = conn
		w io.Writer = conn
	)
	if onRequest := d.OnRequest; onRequest != nil {
		var buf bytes.Buffer
		// First, we must read the entire request.
		req, err := http.ReadRequest(bufio.NewReader(
			io.TeeReader(conn, &buf),
		))
		if err == nil {
			// Fulfill the buffer with the response body.
			io.Copy(ioutil.Discard, req.Body)
			req.Body.Close()
		}
		onRequest(buf.Bytes())

		r = io.MultiReader(
			&buf, conn,
		)
	}

	if onResponse := d.OnResponse; onResponse != nil {
		var buf bytes.Buffer
		// Intercept the response stream written by the Upgrade().
		w = io.MultiWriter(
			conn, &buf,
		)
		defer func() {
			onResponse(buf.Bytes())
		}()
	}

	return d.Upgrader.Upgrade(struct {
		io.Reader
		io.Writer
	}{r, w})
}
1196962
func (m *LocalReleaseModule) Update(current, target *release.Release, req *services.UpdateReleaseRequest, env *environment.Environment) error {
	c := bytes.NewBufferString(current.Manifest)
	t := bytes.NewBufferString(target.Manifest)
	return env.KubeClient.UpdateWithOptions(target.Namespace, c, t, kube.UpdateOptions{
		Force:         req.Force,
		Recreate:      req.Recreate,
		Timeout:       req.Timeout,
		ShouldWait:    req.Wait,
		CleanupOnFail: req.CleanupOnFail,
	})
}
990457
func (p *Progress) Update(message string) {
	switch p.state {
	case "|":
		p.state = "/"
	case "/":
		p.state = "-"
	case "-":
		p.state = "\\"
	case "\\":
		p.state = "|"
	}
	if message != "" {
		p.message = message
	}
}
510314
func (provider *GitlabProvider) PublicData(options map[string]interface{}) (interface{}, error) {
	return gomniauth.ProviderPublicData(provider, options)
}
848659
func (c *FakeStatefulSets) UpdateStatus(statefulSet *v1beta2.StatefulSet) (*v1beta2.StatefulSet, error) {
	obj, err := c.Fake.
		Invokes(testing.NewUpdateSubresourceAction(statefulsetsResource, "status", c.ns, statefulSet), &v1beta2.StatefulSet{})

	if obj == nil {
		return nil, err
	}
	return obj.(*v1beta2.StatefulSet), err
}
897229
func (t readWriteTransaction) updateGlobal(gk, keyBuf, folder, device []byte, file protocol.FileInfo, meta *metadataTracker) ([]byte, bool) {
	l.Debugf("update global; folder=%q device=%v file=%q version=%v invalid=%v", folder, protocol.DeviceIDFromBytes(device), file.Name, file.Version, file.IsInvalid())

	var fl VersionList
	if svl, err := t.Get(gk, nil); err == nil {
		fl.Unmarshal(svl) // Ignore error, continue with empty fl
	}
	fl, removedFV, removedAt, insertedAt := fl.update(folder, device, file, t.readOnlyTransaction)
	if insertedAt == -1 {
		l.Debugln("update global; same version, global unchanged")
		return keyBuf, false
	}

	name := []byte(file.Name)

	var global protocol.FileInfo
	if insertedAt == 0 {
		// Inserted a new newest version
		global = file
	} else {
		keyBuf = t.keyer.GenerateDeviceFileKey(keyBuf, folder, fl.Versions[0].Device, name)
		if new, ok := t.getFileByKey(keyBuf); ok {
			global = new
		} else {
			// This file must exist in the db, so this must be caused
			// by the db being closed - bail out.
			l.Debugln("File should exist:", name)
			return keyBuf, false
		}
	}

	// Fixup the list of files we need.
	keyBuf = t.updateLocalNeed(keyBuf, folder, name, fl, global)

	if removedAt != 0 && insertedAt != 0 {
		l.Debugf(`new global for "%v" after update: %v`, file.Name, fl)
		t.Put(gk, mustMarshal(&fl))
		return keyBuf, true
	}

	// Remove the old global from the global size counter
	var oldGlobalFV FileVersion
	if removedAt == 0 {
		oldGlobalFV = removedFV
	} else if len(fl.Versions) > 1 {
		// The previous newest version is now at index 1
		oldGlobalFV = fl.Versions[1]
	}
	keyBuf = t.keyer.GenerateDeviceFileKey(keyBuf, folder, oldGlobalFV.Device, name)
	if oldFile, ok := t.getFileByKey(keyBuf); ok {
		// A failure to get the file here is surprising and our
		// global size data will be incorrect until a restart...
		meta.removeFile(protocol.GlobalDeviceID, oldFile)
	}

	// Add the new global to the global size counter
	meta.addFile(protocol.GlobalDeviceID, global)

	l.Debugf(`new global for "%v" after update: %v`, file.Name, fl)
	t.Put(gk, mustMarshal(&fl))

	return keyBuf, true
}
298882
func (w *weightedRandomSelect) update(item wrsItem) {
	w.setWeight(item, item.Weight())
}
394488
func (wh *Webhook) Update(client *messagebird.Client) error {
	var data struct {
		Data []Webhook `json:"data"`
	}
	if err := client.Request(&data, http.MethodPut, apiRoot+"/webhooks/"+wh.ID, wh); err != nil {
		return err
	}
	*wh = data.Data[0]
	return nil
}
833824
func Update(id string, params *stripe.RefundParams) (*stripe.Refund, error) {
	return getC().Update(id, params)
}
371679
func (s *OrderService) OrderTrades(symbol string, orderID int64) (*bitfinex.TradeExecutionUpdateSnapshot, error) {
	if symbol == "" {
		return nil, fmt.Errorf("symbol cannot be empty")
	}
	key := fmt.Sprintf("%s:%d", symbol, orderID)
	req, err := s.requestFactory.NewAuthenticatedRequest(path.Join("order", key, "trades"))
	if err != nil {
		return nil, err
	}
	raw, err := s.Request(req)
	if err != nil {
		return nil, err
	}
	return bitfinex.NewTradeExecutionUpdateSnapshotFromRaw(raw)
}
606100
func (g *StandardGauge) Update(v int64) {
	atomic.StoreInt64(&g.value, v)
}
1155840
func (peer *Peer) update() {
	// Start the tickers for the updates
	expire := time.NewTicker(expirationCycle)
	transmit := time.NewTicker(transmissionCycle)

	// Loop and transmit until termination is requested
	for {
		select {
		case <-expire.C:
			peer.expire()

		case <-transmit.C:
			if err := peer.broadcast(); err != nil {
				log.Trace("broadcast failed", "reason", err, "peer", peer.ID())
				return
			}

		case <-peer.quit:
			return
		}
	}
}