type DataDirectory … // OpenOrCreateDataDirectory opens a data directory, creating the directory // if it doesn't not already exist. func OpenOrCreateDataDirectory(path string) (*DataDirectory, error) { … } // Initialize set the version.txt to the target version if the data // directory is empty. If the data directory is non-empty, no // version.txt file will be written since the actual version of etcd // used to create the data is unknown. func (d *DataDirectory) Initialize(target *EtcdVersionPair) error { … } // Backup creates a backup copy of data directory. func (d *DataDirectory) Backup() error { … } // IsEmpty returns true if the data directory is entirely empty. func (d *DataDirectory) IsEmpty() (bool, error) { … } // String returns the data directory path. func (d *DataDirectory) String() string { … } type VersionFile … func (v *VersionFile) nextPath() string { … } // Exists returns true if a version.txt file exists on the file system. func (v *VersionFile) Exists() (bool, error) { … } // Read parses the version.txt file and returns it's contents. func (v *VersionFile) Read() (*EtcdVersionPair, error) { … } // equals returns true iff VersionFile exists and contains given EtcdVersionPair. func (v *VersionFile) equals(vp *EtcdVersionPair) (bool, error) { … } // Write creates or overwrites the contents of the version.txt file with the given EtcdVersionPair. func (v *VersionFile) Write(vp *EtcdVersionPair) error { … } func exists(path string) (bool, error) { … }