Class: Ashikawa::Core::Status

Inherits:
Object
  • Object
show all
Defined in:
lib/ashikawa-core/status.rb

Overview

Wrapper around the status of a collection

Constant Summary collapse

STATUS_NEW_BORN =

ArangoDB Status for a new born collection

1
STATUS_UNLOADED =

ArangoDB Status for a collection that is unloaded

2
STATUS_LOADED =

ArangoDB Status for a collection that is loaded

3
STATUS_BEING_UNLOADED =

ArangoDB Status for a collection that is being unloaded

4
MAX_UNCORRUPTED =

Highest ArangoDB Status that means that the collection is not corrupted

5

Instance Method Summary collapse

Constructor Details

#initialize(code) ⇒ Status

Create a wrapper around a given status

Examples:

Create a new status

status = Ashikawa::Core::Status.new(3)

Parameters:

  • code (Fixnum)


27
28
29
# File 'lib/ashikawa-core/status.rb', line 27

def initialize(code)
  @code = code
end

Instance Method Details

#being_unloaded?Boolean

Checks if the collection is in the process of being unloaded

Examples:

Is the collection unloaded?

status = Ashikawa::Core::Status.new(3)
status.being_unloaded? #=> false

Returns:

  • (Boolean)


71
72
73
# File 'lib/ashikawa-core/status.rb', line 71

def being_unloaded?
  @code == STATUS_BEING_UNLOADED
end

#corrupted?Boolean

Checks if the collection is corrupted

Examples:

Is the collection corrupted?

status = Ashikawa::Core::Status.new(3)
status.corrupted? #=> false

Returns:

  • (Boolean)


82
83
84
# File 'lib/ashikawa-core/status.rb', line 82

def corrupted?
  @code > MAX_UNCORRUPTED
end

#loaded?Boolean

Checks if the collection is loaded

Examples:

Is the collection loaded?

status = Ashikawa::Core::Status.new(3)
status.loaded? #=> true

Returns:

  • (Boolean)


60
61
62
# File 'lib/ashikawa-core/status.rb', line 60

def loaded?
  @code == STATUS_LOADED
end

#new_born?Boolean

Checks if the collection is new born

Examples:

Is the collection new born?

status = Ashikawa::Core::Status.new(3)
status.new_born? #=> false

Returns:

  • (Boolean)


38
39
40
# File 'lib/ashikawa-core/status.rb', line 38

def new_born?
  @code == STATUS_NEW_BORN
end

#unloaded?Boolean

Checks if the collection is unloaded

Examples:

Is the collection unloaded?

status = Ashikawa::Core::Status.new(3)
status.unloaded? #=> false

Returns:

  • (Boolean)


49
50
51
# File 'lib/ashikawa-core/status.rb', line 49

def unloaded?
  @code == STATUS_UNLOADED
end