|
| 1 | +// |
| 2 | +// DISCLAIMER |
| 3 | +// |
| 4 | +// Copyright 2018 ArangoDB GmbH, Cologne, Germany |
| 5 | +// |
| 6 | +// Licensed under the Apache License, Version 2.0 (the "License"); |
| 7 | +// you may not use this file except in compliance with the License. |
| 8 | +// You may obtain a copy of the License at |
| 9 | +// |
| 10 | +// http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | +// |
| 12 | +// Unless required by applicable law or agreed to in writing, software |
| 13 | +// distributed under the License is distributed on an "AS IS" BASIS, |
| 14 | +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 15 | +// See the License for the specific language governing permissions and |
| 16 | +// limitations under the License. |
| 17 | +// |
| 18 | +// Copyright holder is ArangoDB GmbH, Cologne, Germany |
| 19 | +// |
| 20 | +// Author Ewout Prangsma |
| 21 | +// |
| 22 | + |
| 23 | +package service |
| 24 | + |
| 25 | +import driver "github.com/arangodb/go-driver" |
| 26 | + |
| 27 | +// DatabaseFeatures provides information about the features provided by the |
| 28 | +// database in a given version. |
| 29 | +type DatabaseFeatures driver.Version |
| 30 | + |
| 31 | +const ( |
| 32 | + v32 driver.Version = "3.2.0" |
| 33 | + v34 driver.Version = "3.4.0" |
| 34 | +) |
| 35 | + |
| 36 | +// NewDatabaseFeatures returns a new DatabaseFeatures based on |
| 37 | +// the given version. |
| 38 | +func NewDatabaseFeatures(version driver.Version) DatabaseFeatures { |
| 39 | + return DatabaseFeatures(version) |
| 40 | +} |
| 41 | + |
| 42 | +// HasStorageEngineOption returns true when `server.storage-engine` |
| 43 | +// option is supported. |
| 44 | +func (v DatabaseFeatures) HasStorageEngineOption() bool { |
| 45 | + return driver.Version(v).CompareTo(v32) >= 0 |
| 46 | +} |
| 47 | + |
| 48 | +// DefaultStorageEngine returns the default storage engine (mmfiles|rocksdb). |
| 49 | +func (v DatabaseFeatures) DefaultStorageEngine() string { |
| 50 | + if driver.Version(v).CompareTo(v34) >= 0 { |
| 51 | + return "rocksdb" |
| 52 | + } |
| 53 | + return "mmfiles" |
| 54 | +} |
0 commit comments