From fc65716cb14d829c5ad9f79aa909ec0564eea2bd Mon Sep 17 00:00:00 2001
From: chenshijun <csj_sky@126.com>
Date: 星期六, 12 十月 2019 11:36:03 +0800
Subject: [PATCH] 判断SnapshotPath合法性

---
 agent.go |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/agent.go b/agent.go
index 0e36706..ceb7479 100644
--- a/agent.go
+++ b/agent.go
@@ -61,9 +61,9 @@
 }
 
 // Create create serf agent with config
-func Create(conf *Config) (*Agent, error) {
+func Create(conf *Config, snapshotPath string) (*Agent, error) {
 	// config cover to serf config
-	serfConf, err := conf.convertToSerf()
+	serfConf, err := conf.convertToSerf(snapshotPath)
 	if err != nil {
 		return nil, err
 	}
@@ -586,8 +586,8 @@
 }
 
 //Init serf Init
-func Init(clusterID string, password string, nodeID string, addrs []string) (*Agent, error) {
-	agent, err := InitNode(clusterID, password, nodeID)
+func Init(clusterID string, password string, nodeID string, addrs []string, snapshotPath string) (*Agent, error) {
+	agent, err := InitNode(clusterID, password, nodeID, snapshotPath)
 	if err != nil {
 		logger.Error("InitNode failed, error: %s", err)
 		return agent, err
@@ -603,7 +603,7 @@
 }
 
 //InitNode web鍚庡彴鏀跺埌鍒涘缓闆嗙兢鐨勮姹傦紝
-func InitNode(clusterID string, password string, nodeID string) (*Agent, error) {
+func InitNode(clusterID string, password string, nodeID string, snapshotPath string) (*Agent, error) {
 	conf := DefaultConfig()
 	logger.Info("clusterID:", clusterID, "password:", password, "nodeID:", nodeID)
 	conf.ClusterID = clusterID
@@ -619,7 +619,7 @@
 		}
 		conf.EncryptKey = password
 	}
-	agent, err := Create(conf)
+	agent, err := Create(conf, snapshotPath)
 	if err != nil {
 		logger.Error("create agent failed, error: %s", err)
 		return agent, err

--
Gitblit v1.8.0