add function to get readonly scheduler client
This commit is contained in:
parent
51699eda4e
commit
28a6cbdea9
1 changed files with 14 additions and 3 deletions
17
realis.go
17
realis.go
|
@ -17,13 +17,14 @@ package realis
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/base64"
|
"encoding/base64"
|
||||||
|
"net/http"
|
||||||
|
"net/http/cookiejar"
|
||||||
|
"time"
|
||||||
|
|
||||||
"git.apache.org/thrift.git/lib/go/thrift"
|
"git.apache.org/thrift.git/lib/go/thrift"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"github.com/rdelval/gorealis/gen-go/apache/aurora"
|
"github.com/rdelval/gorealis/gen-go/apache/aurora"
|
||||||
"github.com/rdelval/gorealis/response"
|
"github.com/rdelval/gorealis/response"
|
||||||
"net/http"
|
|
||||||
"net/http/cookiejar"
|
|
||||||
"time"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type Realis interface {
|
type Realis interface {
|
||||||
|
@ -62,6 +63,16 @@ func NewClient(config RealisConfig) Realis {
|
||||||
client: aurora.NewAuroraSchedulerManagerClientFactory(config.transport, config.protoFactory)}
|
client: aurora.NewAuroraSchedulerManagerClientFactory(config.transport, config.protoFactory)}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Create a new ReadOnlyClient with a default transport layer
|
||||||
|
func NewReadOnlyClient(config RealisConfig) *aurora.ReadOnlySchedulerClient {
|
||||||
|
|
||||||
|
return aurora.NewReadOnlySchedulerClientFactory(config.transport, config.protoFactory)
|
||||||
|
}
|
||||||
|
|
||||||
|
func CloseReadONlyClient(r *aurora.ReadOnlySchedulerClient) {
|
||||||
|
r.Transport.Close()
|
||||||
|
}
|
||||||
|
|
||||||
// Creates a default Thrift Transport object for communications in gorealis using an HTTP Post Client
|
// Creates a default Thrift Transport object for communications in gorealis using an HTTP Post Client
|
||||||
func defaultTTransport(urlstr string, timeoutms int) (thrift.TTransport, error) {
|
func defaultTTransport(urlstr string, timeoutms int) (thrift.TTransport, error) {
|
||||||
jar, err := cookiejar.New(nil)
|
jar, err := cookiejar.New(nil)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue