monitor_backend.go (430B)
1 package monitor 2 3 import ( 4 //"log" 5 "github.com/gocql/gocql" 6 ) 7 8 type CassandraContext struct { 9 cconfig *gocql.ClusterConfig 10 session *gocql.Session 11 } 12 13 func (c *CassandraContext) StartCassandra(kspace string, addrs ...string) (err error) { 14 c.cconfig = gocql.NewCluster(addrs...) 15 c.cconfig.Keyspace = kspace 16 c.session, err = c.cconfig.CreateSession() 17 return 18 } 19 20 func (c *CassandraContext) StopCassandra() { 21 c.session.Close() 22 }