本文整理汇总了Golang中github.com/concourse/atc/db.NewNotificationsBus函数的典型用法代码示例。如果您正苦于以下问题:Golang NewNotificationsBus函数的具体用法?Golang NewNotificationsBus怎么用?Golang NewNotificationsBus使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了NewNotificationsBus函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: constructDB
func (cmd *ATCCommand) constructDB(logger lager.Logger) (*db.SQLDB, db.PipelineDBFactory, error) {
dbConn, err := migrations.LockDBAndMigrate(logger.Session("db.migrations"), "postgres", cmd.PostgresDataSource)
if err != nil {
return nil, nil, fmt.Errorf("failed to migrate database: %s", err)
}
listener := pq.NewListener(cmd.PostgresDataSource, time.Second, time.Minute, nil)
bus := db.NewNotificationsBus(listener, dbConn)
explainDBConn := db.Explain(logger, dbConn, clock.NewClock(), 500*time.Millisecond)
sqlDB := db.NewSQL(logger.Session("db"), explainDBConn, bus)
pipelineDBFactory := db.NewPipelineDBFactory(logger.Session("db"), explainDBConn, bus, sqlDB)
return sqlDB, pipelineDBFactory, err
}
开发者ID:ACPK,项目名称:atc,代码行数:16,代码来源:command.go
示例2:
"github.com/concourse/atc/db"
"github.com/concourse/atc/event"
)
var _ = Describe("One-off Builds", func() {
var atcProcess ifrit.Process
var dbListener *pq.Listener
var atcPort uint16
var pipelineDBFactory db.PipelineDBFactory
BeforeEach(func() {
dbLogger := lagertest.NewTestLogger("test")
postgresRunner.Truncate()
dbConn = postgresRunner.Open()
dbListener = pq.NewListener(postgresRunner.DataSourceName(), time.Second, time.Minute, nil)
bus := db.NewNotificationsBus(dbListener, dbConn)
sqlDB = db.NewSQL(dbLogger, dbConn, bus)
pipelineDBFactory = db.NewPipelineDBFactory(dbLogger, dbConn, bus, sqlDB)
atcProcess, atcPort = startATC(atcBin, 1)
})
AfterEach(func() {
ginkgomon.Interrupt(atcProcess)
Expect(dbConn.Close()).To(Succeed())
Expect(dbListener.Close()).To(Succeed())
})
Describe("viewing a list of builds", func() {
var page *agouti.Page
开发者ID:ACPK,项目名称:atc,代码行数:31,代码来源:builds_list_test.go
示例3:
var dbConn *sql.DB
var listener *pq.Listener
var pipelineDBFactory db.PipelineDBFactory
var pipelinesDB *fakes.FakePipelinesDB
var _ = Describe("PipelineDBFactory", func() {
BeforeEach(func() {
postgresRunner.CreateTestDB()
dbConn = postgresRunner.Open()
listener = pq.NewListener(postgresRunner.DataSourceName(), time.Second, time.Minute, nil)
Eventually(listener.Ping, 5*time.Second).ShouldNot(HaveOccurred())
bus := db.NewNotificationsBus(listener)
pipelinesDB = new(fakes.FakePipelinesDB)
pipelineDBFactory = db.NewPipelineDBFactory(lagertest.NewTestLogger("test"), dbConn, bus, pipelinesDB)
})
AfterEach(func() {
err := dbConn.Close()
Ω(err).ShouldNot(HaveOccurred())
err = listener.Close()
Ω(err).ShouldNot(HaveOccurred())
postgresRunner.DropTestDB()
})
开发者ID:savaki,项目名称:atc,代码行数:31,代码来源:pipeline_db_factory_test.go
示例4: main
func main() {
flag.Parse()
if !*dev && (*httpUsername == "" || (*httpHashedPassword == "" && *httpPassword == "")) {
fatal(errors.New("must specify -httpUsername and -httpPassword or -httpHashedPassword or turn on dev mode"))
}
if _, err := os.Stat(*templatesDir); err != nil {
fatal(errors.New("directory specified via -templates does not exist"))
}
if _, err := os.Stat(*publicDir); err != nil {
fatal(errors.New("directory specified via -public does not exist"))
}
logger := lager.NewLogger("atc")
logLevel := lager.INFO
if *dev {
logLevel = lager.DEBUG
}
sink := lager.NewReconfigurableSink(lager.NewWriterSink(os.Stdout, lager.DEBUG), logLevel)
logger.RegisterSink(sink)
var err error
var dbConn Db.Conn
for {
dbConn, err = migration.Open(*sqlDriver, *sqlDataSource, migrations.Migrations)
if err != nil {
if strings.Contains(err.Error(), " dial ") {
logger.Error("failed-to-open-db", err)
time.Sleep(5 * time.Second)
continue
}
fatal(err)
}
break
}
dbConn = Db.Explain(logger, dbConn, 500*time.Millisecond)
listener := pq.NewListener(*sqlDataSource, time.Second, time.Minute, nil)
bus := Db.NewNotificationsBus(listener)
db := Db.NewSQL(logger.Session("db"), dbConn, bus)
pipelineDBFactory := Db.NewPipelineDBFactory(logger.Session("db"), dbConn, bus, db)
var configDB Db.ConfigDB
configDB = Db.PlanConvertingConfigDB{db}
var resourceTypesNG []atc.WorkerResourceType
err = json.Unmarshal([]byte(*resourceTypes), &resourceTypesNG)
if err != nil {
logger.Fatal("invalid-resource-types", err)
}
var workerClient worker.Client
if *gardenAddr != "" {
workerClient = worker.NewGardenWorker(
gclient.New(gconn.NewWithLogger(
*gardenNetwork,
*gardenAddr,
logger.Session("garden-connection"),
)),
clock.NewClock(),
-1,
resourceTypesNG,
"linux",
[]string{},
)
} else {
workerClient = worker.NewPool(worker.NewDBWorkerProvider(db, logger))
}
resourceTracker := resource.NewTracker(workerClient)
gardenFactory := exec.NewGardenFactory(workerClient, resourceTracker, func() string {
guid, err := uuid.NewV4()
if err != nil {
panic("not enough entropy to generate guid: " + err.Error())
}
return guid.String()
})
execEngine := engine.NewExecEngine(gardenFactory, engine.NewBuildDelegateFactory(db), db)
engine := engine.NewDBEngine(engine.Engines{execEngine}, db, db)
var webValidator auth.Validator
if *httpUsername != "" && *httpHashedPassword != "" {
webValidator = auth.BasicAuthHashedValidator{
Username: *httpUsername,
HashedPassword: *httpHashedPassword,
}
} else if *httpUsername != "" && *httpPassword != "" {
//.........这里部分代码省略.........
开发者ID:utako,项目名称:atc,代码行数:101,代码来源:main.go
注:本文中的github.com/concourse/atc/db.NewNotificationsBus函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论