Async::ContainerSourceAsyncContainerKeyed

class Keyed

Tracks a key/value pair such that unmarked keys can be identified and cleaned up. This helps implement persistent processes that start up child processes per directory or configuration file. If those directories and/or configuration files are removed, the child process can then be cleaned up automatically, because those key/value pairs will not be marked when reloading the container.

Definitions

attr :key

The key. Normally a symbol or a file-system path.

Signature

attribute Object

attr :value

The value. Normally a child instance of some sort.

Signature

attribute Object

def marked?

Has the instance been marked?

Signature

returns Boolean

Implementation

def marked?
	@marked
end

def mark!

Mark the instance. This will indiciate that the value is still in use/active.

Implementation

def mark!
	@marked = true
end

def clear!

Clear the instance. This is normally done before reloading a container.

Implementation

def clear!
	@marked = false
end

def stop?

Stop the instance if it was not marked.

Implementation

def stop?
	unless @marked
		@value.stop
		return true
	end
end