Module: ZK::Stat

Included in:
Zookeeper::Stat
Defined in:
lib/zk/stat.rb

Overview

Included in Zookeeper::Stat, extends it with some conveniences for dealing with Stat objects. Also provides docuemntation here for the meaning of these values.

Some of the methods added are to match the names in the documentation

Some of this may eventually be pushed down to slyphon-zookeeper

Constant Summary collapse

MEMBERS =
[:version, :exists, :czxid, :mzxid, :ctime, :mtime, :cversion, :aversion, :ephemeralOwner, :dataLength, :numChildren, :pzxid].freeze

Instance Method Summary collapse

Instance Method Details

#==(other) ⇒ Object



14
15
16
# File 'lib/zk/stat.rb', line 14

def ==(other)
  MEMBERS.all? { |m| self.__send__(m) == other.__send__(m) }
end

#acl_list_versionFixnum

The number of changes to the ACL of this znode.

(also: #aversion)

Returns:

  • (Fixnum)


85
86
87
# File 'lib/zk/stat.rb', line 85

def acl_list_version
  aversion
end

#child_list_versionFixnum

The number of changes to the children of this znode

(also: #cversion)

Returns:

  • (Fixnum)


77
78
79
# File 'lib/zk/stat.rb', line 77

def child_list_version
  cversion
end

#created_timeFixnum

The time in milliseconds from epoch when this znode was created

(also: created_time)

Returns:

  • (Fixnum)

See Also:



45
46
47
# File 'lib/zk/stat.rb', line 45

def created_time
  ctime
end

#created_zxidObject

The zxid of the change that caused this znode to be created.

(also: czxid)



27
28
29
30
# File 'lib/zk/stat.rb', line 27

def created_zxid
  # @!parse alias czxid created_zxid
  czxid
end

#ctime_tTime

The time when this znode was created

Returns:

  • (Time)

    creation time of this znode



52
53
54
# File 'lib/zk/stat.rb', line 52

def ctime_t
  Time.at(ctime * 0.001)
end

#data_lengthFixnum

The length of the data field of this znode.

Returns:

  • (Fixnum)


99
100
101
# File 'lib/zk/stat.rb', line 99

def data_length
  super
end

#ephemeral?Boolean

returns true if the node is ephemeral (will be cleaned up when the current session expires)

Returns:

  • (Boolean)


20
21
22
# File 'lib/zk/stat.rb', line 20

def ephemeral?
  ephemeral_owner && (ephemeral_owner != 0)
end

#last_modified_timeFixnum

The time in milliseconds from epoch when this znode was last modified.

(also: mtime)

Returns:

  • (Fixnum)

See Also:



61
62
63
# File 'lib/zk/stat.rb', line 61

def last_modified_time
  mtime
end

#last_modified_zxidObject

The zxid of the change that last modified this znode.

(also: mzxid)



35
36
37
# File 'lib/zk/stat.rb', line 35

def last_modified_zxid
  mzxid
end

#mtime_tTime

The time when this znode was last modified

Returns:

  • (Time)

    last modification time of this znode

See Also:



69
70
71
# File 'lib/zk/stat.rb', line 69

def mtime_t
  Time.at(mtime * 0.001)
end

#num_childrenFixnum

The number of children of this znode.

Returns:

  • (Fixnum)


106
107
108
# File 'lib/zk/stat.rb', line 106

def num_children
  super
end

#versionFixnum

The number of changes to the data of this znode.

Returns:

  • (Fixnum)


92
93
94
# File 'lib/zk/stat.rb', line 92

def version
  super
end