diff --git a/realis.go b/realis.go index 2d1ee47..573cc5b 100644 --- a/realis.go +++ b/realis.go @@ -17,13 +17,14 @@ package realis import ( "encoding/base64" + "net/http" + "net/http/cookiejar" + "time" + "git.apache.org/thrift.git/lib/go/thrift" "github.com/pkg/errors" "github.com/rdelval/gorealis/gen-go/apache/aurora" "github.com/rdelval/gorealis/response" - "net/http" - "net/http/cookiejar" - "time" ) type Realis interface { @@ -62,6 +63,16 @@ func NewClient(config RealisConfig) Realis { 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 func defaultTTransport(urlstr string, timeoutms int) (thrift.TTransport, error) { jar, err := cookiejar.New(nil)