func (z *zkCluster) GetQueryNodes() ([]clustering.QueryNode, errors.Error) { impl, ok := getConfigStoreImplementation(z) if !ok { return nil, errors.NewAdminConnectionError(nil, z.ConfigurationStoreId()) } qryNodes := []clustering.QueryNode{} nodes, _, err := impl.conn.Children("/" + z.Name()) if err != nil { return nil, errors.NewAdminGetClusterError(err, z.Name()) } for _, name := range nodes { nodePath := "/" + z.Name() + "/" + name data, _, err := impl.conn.Get(nodePath) if err != nil { return nil, errors.NewAdminGetNodeError(err, nodePath) } queryNode := &zkQueryNodeConfig{} err = json.Unmarshal(data, queryNode) if err != nil { return nil, errors.NewAdminDecodingError(err) } qryNodes = append(qryNodes, queryNode) } return qryNodes, nil }
// helper method to get all the services in a pool func (c *cbConfigStore) getPoolServices(name string) (couchbase.PoolServices, errors.Error) { poolServices, err := c.cbConn.GetPoolServices(name) if err != nil { return poolServices, errors.NewAdminGetClusterError(err, name) } return poolServices, nil }
func (z *zkConfigStore) ClusterNames() ([]string, errors.Error) { clusterIds := []string{} nodes, _, err := z.conn.Children("/") if err != nil { return nil, errors.NewAdminGetClusterError(err, "/") } for _, name := range nodes { clusterIds = append(clusterIds, name) } return clusterIds, nil }
func (c *cbConfigStore) ClusterByName(name string) (clustering.Cluster, errors.Error) { _, err := c.cbConn.GetPool(name) if err != nil { return nil, errors.NewAdminGetClusterError(err, name) } return &cbCluster{ configStore: c, ClusterName: name, ConfigstoreURI: c.URL(), DatastoreURI: c.URL(), }, nil }
func (z *zkConfigStore) ClusterByName(name string) (clustering.Cluster, errors.Error) { data, _, err := z.conn.Get("/" + name) if err != nil { return nil, errors.NewAdminGetClusterError(err, name) } var clusterConfig zkCluster err = json.Unmarshal(data, &clusterConfig) if err != nil { return nil, errors.NewAdminDecodingError(err) } clusterConfig.configStore = z return &clusterConfig, nil }
func (z *zkConfigStore) GetClusters() ([]clustering.Cluster, errors.Error) { clusters := []clustering.Cluster{} nodes, _, err := z.conn.Children("/") if err != nil { return nil, errors.NewAdminGetClusterError(err, "/") } for _, name := range nodes { if name == _RESERVED_NAME { continue } data, _, err := z.conn.Get("/" + name) if err != nil { return nil, errors.NewAdminGetClusterError(err, name) } cluster := &zkCluster{} err = json.Unmarshal(data, cluster) if err != nil { return nil, errors.NewAdminDecodingError(err) } clusters = append(clusters, cluster) } return clusters, nil }
func (z *zkCluster) QueryNodeNames() ([]string, errors.Error) { queryNodeNames := []string{} impl, ok := getConfigStoreImplementation(z) if !ok { return nil, errors.NewAdminConnectionError(nil, z.ConfigurationStoreId()) } nodes, _, err := impl.conn.Children("/" + z.ClusterName) if err != nil { return nil, errors.NewAdminGetClusterError(err, z.ClusterName) } for _, name := range nodes { queryNodeNames = append(queryNodeNames, name) } return queryNodeNames, nil }