Selaa lähdekoodia

Added PageSize as a property for ClusterConfig

This is intended to make it easy to set a default PageSize for all CQL
sessions that share the same configuration.
dkinder 10 vuotta sitten
vanhempi
commit
69b64836d4
2 muutettua tiedostoa jossa 3 lisäystä ja 0 poistoa
  1. 1 0
      AUTHORS
  2. 2 0
      cluster.go

+ 1 - 0
AUTHORS

@@ -41,3 +41,4 @@ Dmitriy Fedorenko <c0va23@gmail.com>
 Zach Marcantel <zmarcantel@gmail.com>
 James Maloney <jamessagan@gmail.com>
 Ashwin Purohit <purohit@gmail.com>
+Dan Kinder <dkinder.is.me@gmail.com>

+ 2 - 0
cluster.go

@@ -61,6 +61,7 @@ type ClusterConfig struct {
 	ConnPoolType     NewPoolFunc   // The function used to create the connection pool for the session (default: NewSimplePool)
 	DiscoverHosts    bool          // If set, gocql will attempt to automatically discover other members of the Cassandra cluster (default: false)
 	MaxPreparedStmts int           // Sets the maximum cache size for prepared statements globally for gocql (default: 1000)
+	PageSize         int           // Default page size to use for created sessions (default: 0)
 	Discovery        DiscoveryConfig
 	SslOpts          *SslOptions
 }
@@ -106,6 +107,7 @@ func (cfg *ClusterConfig) CreateSession() (*Session, error) {
 	if pool.Size() > 0 {
 		s := NewSession(pool, *cfg)
 		s.SetConsistency(cfg.Consistency)
+		s.SetPageSize(cfg.PageSize)
 
 		if cfg.DiscoverHosts {
 			hostSource := &ringDescriber{