diff --git a/cacheHelper.go b/cacheHelper.go index 8f677db0c6e44399e9893a1bb6bb7b93271e3dd5..422621864c74c5da05ce0dd09236e6e63015e247 100644 --- a/cacheHelper.go +++ b/cacheHelper.go @@ -7,15 +7,15 @@ import ( "github.com/allegro/bigcache" ) - const ( - BIGCACHEShards=8 - BIGCACHEMaxEntrySize=1024 - BIGCACHEVerbose=true - BIGCACHEHardMaxCacheSize=0 - BIGCACHEMaxEntriesInWindow=1000 10 60 - BIGCACHELifeWindow=2 + BIGCACHEShards = 8 + BIGCACHEMaxEntrySize = 1024 + BIGCACHEVerbose = true + BIGCACHEHardMaxCacheSize = 0 + BIGCACHEMaxEntriesInWindow = 1000 * 10 * 60 + BIGCACHELifeWindow = 2 ) + var bigcacheConfig = bigcache.Config{ // number of shards (must be a power of 2) // Shards: 4096, @@ -23,7 +23,7 @@ var bigcacheConfig = bigcache.Config{ // time after which entry can be evicted LifeWindow: BIGCACHELifeWindow * time.Hour, // rps * lifeWindow, used only in initial memory allocation - MaxEntriesInWindow: 1000 * 10 * 60, + MaxEntriesInWindow: BIGCACHEMaxEntriesInWindow, // MaxEntriesInWindow: 10, // max entry size in bytes, used only in initial memory allocation MaxEntrySize: BIGCACHEMaxEntrySize, diff --git a/dalFDB.go b/dalFDB.go new file mode 100644 index 0000000000000000000000000000000000000000..ab6295c04b3e79e23395519d6e717fbbd85f2d68 --- /dev/null +++ b/dalFDB.go @@ -0,0 +1,28 @@ +package coreos + +import ( + "fmt" + + "time" + +) + +//GetDataFromFDB gets data from FDB +func GetDataFromFDB(filePath string) ([]byte, error) { + data, err := ReadFile(filePath) + return data, err +} + +//SaveDataToFDB saves data to FDB +func SaveDataToFDB(filePath string, data []byte) error { + err := WriteFile(filePath, data) + fmt.Println(err) + return err +} + +//DeleteFileFromFDB deletes file to FDB +func DeleteFileFromFDB(filePath string) error { + newFilePath := filePath + "_deleted_" + time.Now().String() + err := RenameFile(filePath, newFilePath) + return err +} diff --git a/dalNoSQL.go b/dalNoSQL.go index 1b309258afa7398cd5fc8339cc375a327496df2b..4edbafd17f957297b2fcc50545fdb2377fe8dde3 100644 --- a/dalNoSQL.go +++ b/dalNoSQL.go @@ -16,7 +16,7 @@ func GetMongoConnection() *mgo.Session { Host := []string{ GetConfig("MONGODSN"), } - const ( + var ( Username = "" Password = "" Database = GetConfig("DBNAME") diff --git a/validationHelper.go b/validationHelper.go index 74b785cf45268edb088fac46638c891ab1595fc9..b4b4a1251f210a7d46c00bfedf50c6c00e34537d 100644 --- a/validationHelper.go +++ b/validationHelper.go @@ -4,6 +4,7 @@ import ( "github.com/go-playground/locales/en" ut "github.com/go-playground/universal-translator" + validator "gopkg.in/go-playground/validator.v9" en_translations "gopkg.in/go-playground/validator.v9/translations/en" )