From 6d0a2b62a05d146440b425598201d52a56b8c911 Mon Sep 17 00:00:00 2001
From: liuxiaolong <736321739@qq.com>
Date: 星期二, 02 七月 2019 13:16:57 +0800
Subject: [PATCH] use camera and localconfig cache

---
 cache/cache.go |   13 +++++++------
 1 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/cache/cache.go b/cache/cache.go
index 70af5aa..2071d96 100644
--- a/cache/cache.go
+++ b/cache/cache.go
@@ -5,6 +5,7 @@
 	"basic.com/pubsub/cache.git/shardmap"
 	"basic.com/pubsub/protomsg.git"
 	"basic.com/valib/gopherdiscovery.git"
+	"errors"
 	"fmt"
 	"github.com/gogo/protobuf/proto"
 	"github.com/satori/go.uuid"
@@ -126,22 +127,22 @@
 	}
 }
 
-func GetServerInfo() *protomsg.LocalConfig {
+func GetServerInfo() (con protomsg.LocalConfig,err error) {
 	config, b := cMap.Get(SERVER_KEY)
 	if b {
-		return config.(*protomsg.LocalConfig)
+		return config.(protomsg.LocalConfig),nil
 	} else {
-		return nil
+		return con,errors.New("conf not found")
 	}
 }
 
 //閫氳繃cameraId鑾峰彇鎽勫儚鏈轰俊鎭�
-func GetCameraById(cameraId string) *protomsg.Camera {
+func GetCameraById(cameraId string) (c protomsg.Camera,err error) {
 	cam, b := cMap.Get(PREFIX_CAMERA + cameraId)
 	if b {
-		return cam.(*protomsg.Camera)
+		return cam.(protomsg.Camera),nil
 	} else {
-		return nil
+		return c,errors.New("camera not found")
 	}
 }
 

--
Gitblit v1.8.0