Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrInvalidConfigType = errors.New("Invalid configuration type")
ErrInvalidConfigType tells you that you specified a configuration type which is invalid. Helpful, I know. At the time of this writing all that is supported is json, and so you probably intend (or have) to use that.
Functions ¶
This section is empty.
Types ¶
type DB ¶
DB consumes Server structs for configuration, and uses the contained information to provide a lookup mechanism for getting *sql.DB pointers that allows for multi datacenter, weighted read, and write server support
func ReadFile ¶
ReadFile accepts a path and optional kind in additional to the stantard New function and its datacenter parameter. The path should be a path to a real file that is readable and contains the proper data in the proper format. The only "kind" that is supported right now is "json".
For json the config file should be formatted as follows:
{ ds: "users", dc: "dfw" [...] }
{ ds: "users", dc: "dfw" [...] }
[...]
type Server ¶
type Server struct {
Dataset string `json:"ds"`
Datacenter string `json:"dc"`
ReadPriority int `json:"read"`
WritePriority int `json:"write"`
WANAddress string `json:"wan"`
LANAddress string `json:"lan"`
Database string `json:"db"`
Username string `json:"user"`
Password string `json:"pw"`
// contains filtered or unexported fields
}
Server is the unit of configuration for HyperDB. From this structure we can determine which servers in which locations you can, or should, run your query against.