Skip to content

Commit

Permalink
Comments and Readme changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Ben Frye committed Jun 17, 2014
1 parent a3fe3be commit e42185c
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 13 deletions.
Empty file added .gitignore
Empty file.
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,4 @@ Dan Forest <[email protected]>
Miguel Serrano <[email protected]>
Stefan Radomski <[email protected]>
Josh Wright <[email protected]>
Ben Frye <[email protected]>
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ Features
* Round robin distribution of queries to different hosts
* Round robin distribution of queries to different connections on a host
* Each connection can execute up to 128 concurrent queries
* Optional automatic discovery of nodes
* Iteration over paged results with configurable page size
* Optional frame compression (using snappy)
* Automatic query preparation
Expand Down
26 changes: 13 additions & 13 deletions cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,22 +28,22 @@ type ClusterConfig struct {
RetryPolicy RetryPolicy // Default retry policy to use for queries (default: 0)
SocketKeepalive time.Duration // The keepalive period to use, enabled if > 0 (default: 0)
ConnPoolType NewPoolFunc // The function used to create the connection pool for the session (default: NewSimplePool)
DiscoverHosts bool // Whether or not CreateSession should attempt to fill out
DiscoverHosts bool // If set, gocql will attempt to automatically discover other members of the Cassandra cluster (default: false)
}

// NewCluster generates a new config for the default cluster implementation.
func NewCluster(hosts ...string) *ClusterConfig {
cfg := &ClusterConfig{
Hosts: hosts,
CQLVersion: "3.0.0",
ProtoVersion: 2,
Timeout: 600 * time.Millisecond,
DefaultPort: 9042,
NumConns: 2,
NumStreams: 128,
Consistency: Quorum,
ConnPoolType: NewSimplePool,
DiscoverHosts: false,
Hosts: hosts,
CQLVersion: "3.0.0",
ProtoVersion: 2,
Timeout: 600 * time.Millisecond,
DefaultPort: 9042,
NumConns: 2,
NumStreams: 128,
Consistency: Quorum,
ConnPoolType: NewSimplePool,
DiscoverHosts: false,
}
return cfg
}
Expand Down Expand Up @@ -76,7 +76,7 @@ func (cfg *ClusterConfig) CreateSession() (*Session, error) {
exists = true
}
}
if !exists{
if !exists {
cfg.Hosts = append(cfg.Hosts, ip)
}
}
Expand All @@ -97,5 +97,5 @@ func (cfg *ClusterConfig) CreateSession() (*Session, error) {
var (
ErrNoHosts = errors.New("no hosts provided")
ErrNoConnectionsStarted = errors.New("no connections were made when creating the session")
ErrHostQueryFailed = errors.New("unable to populate Hosts")
ErrHostQueryFailed = errors.New("unable to populate Hosts")
)

0 comments on commit e42185c

Please sign in to comment.