index_alias.go 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. // Copyright (c) 2014 Couchbase, Inc.
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. package bleve
  15. // An IndexAlias is a wrapper around one or more
  16. // Index objects. It has two distinct modes of
  17. // operation.
  18. // 1. When it points to a single index, ALL index
  19. // operations are valid and will be passed through
  20. // to the underlying index.
  21. // 2. When it points to more than one index, the only
  22. // valid operation is Search. In this case the
  23. // search will be performed across all the
  24. // underlying indexes and the results merged.
  25. // Calls to Add/Remove/Swap the underlying indexes
  26. // are atomic, so you can safely change the
  27. // underlying Index objects while other components
  28. // are performing operations.
  29. type IndexAlias interface {
  30. Index
  31. Add(i ...Index)
  32. Remove(i ...Index)
  33. Swap(in, out []Index)
  34. }