etcdmain, embed: export Config and StartEtcd into embed/

Lets programs embed etcd.

Fixes #5430
This commit is contained in:
Anthony Romano
2016-07-10 11:06:08 -07:00
parent b9f6de9277
commit f4f33ea767
10 changed files with 959 additions and 704 deletions

37
embed/doc.go Normal file
View File

@ -0,0 +1,37 @@
// Copyright 2016 The etcd Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/*
Package embed provides bindings for embedding an etcd server in a program.
Launch an embedded etcd server using the configuration defaults:
import (
"log"
"github.com/coreos/etcd/embed"
)
func main() {
cfg := embed.NewConfig()
cfg.Dir = "default.etcd"
e, err := embed.StartEtcd(cfg)
if err != nil {
log.Fatal(err)
}
defer e.Close()
log.Fatal(<-e.Err())
}
*/
package embed