本文整理匯總了Golang中configuration.Configuration.AdminHttpPortString方法的典型用法代碼示例。如果您正苦於以下問題:Golang Configuration.AdminHttpPortString方法的具體用法?Golang Configuration.AdminHttpPortString怎麽用?Golang Configuration.AdminHttpPortString使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類configuration.Configuration
的用法示例。
在下文中一共展示了Configuration.AdminHttpPortString方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: NewServer
func NewServer(config *configuration.Configuration) (*Server, error) {
log.Info("Opening database at %s", config.DataDir)
db, err := datastore.NewLevelDbDatastore(config.DataDir, config.LevelDbMaxOpenFiles)
if err != nil {
return nil, err
}
clusterConfig := coordinator.NewClusterConfiguration(config)
raftServer := coordinator.NewRaftServer(config, clusterConfig)
coord := coordinator.NewCoordinatorImpl(db, raftServer, clusterConfig)
go coord.SyncLogs()
requestHandler := coordinator.NewProtobufRequestHandler(db, coord, clusterConfig)
protobufServer := coordinator.NewProtobufServer(config.ProtobufPortString(), requestHandler)
eng, err := engine.NewQueryEngine(coord)
if err != nil {
return nil, err
}
raftServer.AssignEngineAndCoordinator(eng, coord)
httpApi := http.NewHttpServer(config.ApiHttpPortString(), config.AdminAssetsDir, eng, coord, coord)
httpApi.EnableSsl(config.ApiHttpSslPortString(), config.ApiHttpCertPath)
adminServer := admin.NewHttpServer(config.AdminAssetsDir, config.AdminHttpPortString())
return &Server{
RaftServer: raftServer,
Db: db,
ProtobufServer: protobufServer,
ClusterConfig: clusterConfig,
HttpApi: httpApi,
Coordinator: coord,
AdminServer: adminServer,
Config: config,
RequestHandler: requestHandler}, nil
}
示例2: NewServer
func NewServer(config *configuration.Configuration) (*Server, error) {
log.Info("Opening database at %s", config.DataDir)
metaStore := metastore.NewStore()
shardDb, err := datastore.NewShardDatastore(config, metaStore)
if err != nil {
return nil, err
}
newClient := func(connectString string) cluster.ServerConnection {
return coordinator.NewProtobufClient(connectString, config.ProtobufTimeout.Duration)
}
writeLog, err := wal.NewWAL(config)
if err != nil {
return nil, err
}
clusterConfig := cluster.NewClusterConfiguration(config, writeLog, shardDb, newClient, metaStore)
raftServer := coordinator.NewRaftServer(config, clusterConfig)
metaStore.SetClusterConsensus(raftServer)
clusterConfig.LocalRaftName = raftServer.GetRaftName()
clusterConfig.SetShardCreator(raftServer)
clusterConfig.CreateFutureShardsAutomaticallyBeforeTimeComes()
coord := coordinator.NewCoordinatorImpl(config, raftServer, clusterConfig, metaStore)
requestHandler := coordinator.NewProtobufRequestHandler(coord, clusterConfig)
protobufServer := coordinator.NewProtobufServer(config.ProtobufListenString(), requestHandler)
raftServer.AssignCoordinator(coord)
httpApi := http.NewHttpServer(config.ApiHttpPortString(), config.ApiReadTimeout, config.AdminAssetsDir, coord, coord, clusterConfig, raftServer)
httpApi.EnableSsl(config.ApiHttpSslPortString(), config.ApiHttpCertPath)
graphiteApi := graphite.NewServer(config, coord, clusterConfig)
adminServer := admin.NewHttpServer(config.AdminAssetsDir, config.AdminHttpPortString())
return &Server{
RaftServer: raftServer,
ProtobufServer: protobufServer,
ClusterConfig: clusterConfig,
HttpApi: httpApi,
GraphiteApi: graphiteApi,
Coordinator: coord,
AdminServer: adminServer,
Config: config,
RequestHandler: requestHandler,
writeLog: writeLog,
shardStore: shardDb}, nil
}