Merge "pkg/serverinit: allow sorted for other indexes"

This commit is contained in:
Mathieu Lonjaret 2016-06-02 14:39:24 +00:00 committed by Gerrit Code Review
commit a0271c3cc9
3 changed files with 103 additions and 1 deletions

View File

@ -177,6 +177,26 @@ func (b *lowBuilder) addPublishedConfig(tlsO *tlsOpts) error {
return nil
}
func (b *lowBuilder) sortedName() string {
switch {
case b.high.MySQL != "":
return "MySQL"
case b.high.PostgreSQL != "":
return "PostgreSQL"
case b.high.Mongo != "":
return "MongoDB"
case b.high.MemoryIndex:
return "in memory LevelDB"
case b.high.SQLite != "":
return "SQLite"
case b.high.KVFile != "":
return "cznic/kv"
case b.high.LevelDB != "":
return "LevelDB"
}
panic("internal error: sortedName didn't find a sorted implementation")
}
// kvFileType returns the file based sorted type defined for index storage, if
// any. It defaults to "leveldb" otherwise.
func (b *lowBuilder) kvFileType() string {
@ -806,7 +826,7 @@ func (b *lowBuilder) build() (*Config, error) {
case b.runIndex() && numIndexers != 1:
return nil, fmt.Errorf("With runIndex set true, you can only pick exactly one indexer (mongo, mysql, postgres, sqlite, kvIndexFile, leveldb, memoryIndex).")
case !b.runIndex() && numIndexers != 0:
return nil, fmt.Errorf("With runIndex disabled, you can't specify any of mongo, mysql, postgres, sqlite.")
log.Printf("Indexer disabled, but %v will be used for other indexes, queues, caches, etc.", b.sortedName())
}
if conf.Identity == "" {

View File

@ -0,0 +1,70 @@
{
"auth": "userpass:camlistore:pass3179",
"https": false,
"listen": "localhost:3179",
"prefixes": {
"/": {
"handler": "root",
"handlerArgs": {
"blobRoot": "/bs/",
"jsonSignRoot": "/sighelper/",
"helpRoot": "/help/",
"ownerName": "Alice",
"statusRoot": "/status/",
"stealth": false
}
},
"/bs/": {
"handler": "storage-blobpacked",
"handlerArgs": {
"smallBlobs": "/bs-loose/",
"largeBlobs": "/bs-packed/",
"metaIndex": {
"file": "/tmp/blobs/packed/packindex.leveldb",
"type": "leveldb"
}
}
},
"/bs-loose/": {
"handler": "storage-filesystem",
"handlerArgs": {
"path": "/tmp/blobs"
}
},
"/bs-packed/": {
"handler": "storage-filesystem",
"handlerArgs": {
"path": "/tmp/blobs/packed"
}
},
"/cache/": {
"handler": "storage-filesystem",
"handlerArgs": {
"path": "/tmp/blobs/cache"
}
},
"/help/": {
"handler": "help"
},
"/setup/": {
"handler": "setup"
},
"/share/": {
"handler": "share",
"handlerArgs": {
"blobRoot": "/bs/"
}
},
"/sighelper/": {
"handler": "jsonsign",
"handlerArgs": {
"keyId": "26F5ABDA",
"publicKeyDest": "/bs/",
"secretRing": "/path/to/secring"
}
},
"/status/": {
"handler": "status"
}
}
}

View File

@ -0,0 +1,12 @@
{
"listen": "localhost:3179",
"auth": "userpass:camlistore:pass3179",
"blobPath": "/tmp/blobs",
"packRelated": true,
"levelDB": "/path/to/leveldb.db",
"runIndex": false,
"identity": "26F5ABDA",
"identitySecretRing": "/path/to/secring",
"ownerName": "Alice",
"shareHandlerPath": "/share/"
}