cari

module
v0.6.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 25, 2022 License: Apache-2.0

README

CARI

the full name is cloud application runtime interface, it defines the interfaces of cloud services that application should follow to run in cloud

packages

config

defines a common struct to store kv configuration

discovery

defines a standard service for register and discovery, service like eureka,consul and service center

security

defines a common interface to encrypt and decrypt info

rbac

defines a common struct to account and role info

db

defines a config struct to connect db, contains two connection methods of db (etcd and mongo)

how to use it

  1. First you should import the bootstrap package
import (
    _ "github.com/go-chassis/cari/db/bootstrap"
)
  1. The second initialization db selects etcd or mongo
     // etcd
    cfg:=config.Config{
        Kind:    "mongo",
        URI:     "mongodb://127.0.0.1:27017",
        Timeout: 10 * time.Second,
    }
    // or mongo
    cfg:=config.Config{
        Kind:    "mongo",
        URI:     "mongodb://127.0.0.1:27017",
        Timeout: 10 * time.Second,
    }
    err = db.Init(&cfg)
  1. Using etcd client
    etcdadpt.Put()
  1. Using mongo client
    mongo.GetClient().GetDB()

sync

defines common structs for synchronization mechanism, synchronize data to different peer clusters

dlock

dlock provide distributed lock function

how to use it

  1. First you should initialize db

  2. Second import dlock bootstrap package

    import (
        _ "github.com/go-chassis/cari/dlock/bootstrap"
    )
  1. Init dlock
    dlock.Init(dlock.Options{Kind: "etcd")

Directories

Path Synopsis
db
Package dlock provide distributed lock function
Package dlock provide distributed lock function
pkg
errsvc
err package define the register of business errors
err package define the register of business errors
Package rbac extract common functions to help component to implement a auth system
Package rbac extract common functions to help component to implement a auth system
Package security created on 2017/6/22
Package security created on 2017/6/22

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL