// Write the state.
339493
func (r *AutoVXLANOperResource) Write() error {
	key := fmt.Sprintf(vXLANResourceOperPath, r.ID)
	return r.StateDriver.WriteState(key, r, json.Marshal)
}
745868
func (d *State364) Write(p []byte) (nn int, err error) {
	l := len(p)
	d.clen += l
	d.tail = append(d.tail, p...)
	return l, nil
}
1144147
func (f *StateFile) Write(code, info string, disconnected *Disconnected) error {
	st := state{
		Code:         code,
		Info:         info,
		Disconnected: disconnected,
	}

	return errors.Trace(utils.WriteYaml(f.path, st))
}
693429
func (f *StateFile) Write(st *State) error {
	if err := st.validate(); err != nil {
		return errors.Trace(err)
	}
	return utils.WriteYaml(f.path, st)
}
313149
func (s *CfgEndpointState) Write() error {
	key := fmt.Sprintf(endpointConfigPath, s.ID)
	return s.StateDriver.WriteState(key, s, json.Marshal)
}
853208
func (ui UgenInput) Write(w io.Writer) error {
	if we := binary.Write(w, byteOrder, ui.UgenIndex); we != nil {
		return we
	}
	return binary.Write(w, byteOrder, ui.OutputIndex)
}
599888
func (ini *INI) write(kv Kvmap, buf *bufio.Writer) {
    for k, v := range kv {
        buf.WriteString(k)
        buf.WriteString(ini.kvSep)
        buf.WriteString(v)
        buf.WriteString(ini.lineSep)
    }
}
728949
func (w *ConditionalWrite) Write(s string) {
	w.Queued = append(w.Queued, s)
}
22504
func (this *statusResponseWriter) Write(data []byte) (int, error) {
	if this.code == 0 {
		this.code = http.StatusOK
	}
	return this.ResponseWriter.Write(data)
}
1271143
func (r *AutoVXLANCfgResource) Write() error {
	key := fmt.Sprintf(vXLANResourceConfigPath, r.ID)
	return r.StateDriver.WriteState(key, r, json.Marshal)
}
1149986
func (d *ConsulStateDriver) Write(key string, value []byte) error {
	key = processKey(key)

	var err error

	for i := 0; i < maxConsulRetries; i++ {
		_, err = d.Client.KV().Put(&api.KVPair{Key: key, Value: value}, nil)
		if err != nil && (api.IsServerError(err) || strings.Contains(err.Error(), "EOF") || strings.Contains(err.Error(), "connection refused")) {
			// Retry after a delay
			time.Sleep(time.Second)
			continue
		}

		// when err == nil or anything other than connection refused
		return err
	}

	// err could be anything other than connection refused
	return err
}
649749
func (s *Logging) Write(b []byte) (int, error) {
	s.mutex.RLock()
	w := s.writer
	s.mutex.RUnlock()

	return w.Write(b)
}
1095036
func (s *sessionsResponseWriter) Write(buf []byte) (int, error) {
	if !s.wroteHeader {
		s.WriteHeader(http.StatusOK)
	}
	return s.ResponseWriter.Write(buf)
}
1059940
func (r *AutoVLANCfgResource) Write() error {
	key := fmt.Sprintf(vLANResourceConfigPath, r.ID)
	return r.StateDriver.WriteState(key, r, json.Marshal)
}
827061
func (c *ControlWriter) Write(p []byte) (n int, err error) {
	if c.n+len(p) > c.limit {
		return 0, ErrControlOverflow
	}
	return c.w.Write(p)
}
160177
func WriteState(d *State, dst io.Writer) error {
	// writing a nil state is a noop.
	if d == nil {
		return nil
	}

	// make sure we have no uninitialized fields
	d.init()

	// Make sure it is sorted
	d.sort()

	// Ensure the version is set
	d.Version = StateVersion

	// If the TFVersion is set, verify it. We used to just set the version
	// here, but this isn't safe since it changes the MD5 sum on some remote
	// state storage backends such as Atlas. We now leave it be if needed.
	if d.TFVersion != "" {
		if _, err := version.NewVersion(d.TFVersion); err != nil {
			return fmt.Errorf(
				"Error writing state, invalid version: %s\n\n"+
					"The Terraform version when writing the state must be a semantic\n"+
					"version.",
				d.TFVersion)
		}
	}

	// Encode the data in a human-friendly way
	data, err := json.MarshalIndent(d, "", "    ")
	if err != nil {
		return fmt.Errorf("Failed to encode state: %s", err)
	}

	// We append a newline to the data because MarshalIndent doesn't
	data = append(data, '\n')

	// Write the data out to the dst
	if _, err := io.Copy(dst, bytes.NewReader(data)); err != nil {
		return fmt.Errorf("Failed to write state: %v", err)
	}

	return nil
}
233956
func (w *Writer) Write(p []byte) (n int, err error) {
	return w.buf.Write(p)
}