summaryrefslogtreecommitdiffstats
path: root/vnfs/DAaaS/microservices/GoApps/src/go-hdfs-writer/pkg/utils/hdfsUtils.go
diff options
context:
space:
mode:
authorRajamohan Raj <rajamohan.raj@intel.com>2019-10-15 00:48:18 +0000
committerMarco Platania <platania@research.att.com>2019-10-15 13:30:04 +0000
commit99f7370360201104ddfc99b5e766b4e32e8524cc (patch)
tree9e7dbc4db186e85afd0654b64bdb4cabdb7b81ab /vnfs/DAaaS/microservices/GoApps/src/go-hdfs-writer/pkg/utils/hdfsUtils.go
parent3289af42fd3af32fd07c565d072c65743249ebce (diff)
HDFSWriter microservice working copy
Issue-ID: ONAPARC-453 Signed-off-by: Rajamohan Raj <rajamohan.raj@intel.com> Change-Id: I11c91b642e466763c1ca6f5734bf81fb260e2b39
Diffstat (limited to 'vnfs/DAaaS/microservices/GoApps/src/go-hdfs-writer/pkg/utils/hdfsUtils.go')
-rw-r--r--vnfs/DAaaS/microservices/GoApps/src/go-hdfs-writer/pkg/utils/hdfsUtils.go33
1 files changed, 33 insertions, 0 deletions
diff --git a/vnfs/DAaaS/microservices/GoApps/src/go-hdfs-writer/pkg/utils/hdfsUtils.go b/vnfs/DAaaS/microservices/GoApps/src/go-hdfs-writer/pkg/utils/hdfsUtils.go
new file mode 100644
index 00000000..1a93a5ad
--- /dev/null
+++ b/vnfs/DAaaS/microservices/GoApps/src/go-hdfs-writer/pkg/utils/hdfsUtils.go
@@ -0,0 +1,33 @@
+package utils
+
+import (
+ "fmt"
+ "github.com/colinmarc/hdfs"
+ //"sync"
+ //"go.uber.org/zap"
+)
+
+
+//var clientOnce sync.Once
+//var hdfsClient *hdfs.Client
+//var slogger *zap.SugaredLogger
+
+
+//GetHdfsClientInstance returns a singleton hdfsClient instance
+// func GetHdfsClientInstance(hdfsURL string) (*hdfs.Client){
+// clientOnce.Do(func(){
+// hdfsClient = createHdfsClient(hdfsURL)
+// })
+// return hdfsClient
+// }
+
+//CreateHdfsClient creates a hdfs client and returns hdfs client
+func CreateHdfsClient(hdfsURL string) (*hdfs.Client){
+ slogger := GetLoggerInstance()
+ hdfsClient, hdfsConnectError := hdfs.New(hdfsURL)
+ if hdfsConnectError !=nil {
+ slogger.Fatalf(":::Error in create hdfsClient::: %v", hdfsConnectError)
+ fmt.Printf("::Unable to initialize hdfsURL, check logs")
+ }
+ return hdfsClient
+} \ No newline at end of file