Add (de)allocateChannel functions to AIR.

This commit is contained in:
Sam Edwards 2013-10-08 17:11:30 -06:00
parent 0c920af810
commit 6a39b5ec60
1 changed files with 18 additions and 1 deletions

View File

@ -32,7 +32,7 @@ class AstronInternalRepository(ConnectionRepository):
maxChannels = self.config.GetInt('air-channel-allocation', 1000000)
self.channelAllocator = UniqueIdAllocator(baseChannel, baseChannel+maxChannels-1)
self.ourChannel = self.channelAllocator.allocate()
self.ourChannel = self.allocateChannel()
self.eventLogId = self.config.GetString('eventlog-id', 'AIR:%d' % self.ourChannel)
self.eventSocket = None
@ -46,6 +46,23 @@ class AstronInternalRepository(ConnectionRepository):
self.readDCFile(dcFileNames)
def allocateChannel(self):
"""
Allocate an unused channel out of this AIR's configured channel space.
This is also used to allocate IDs for DistributedObjects, since those
occupy a channel.
"""
return self.channelAllocator.allocate()
def deallocateChannel(self, channel):
"""
Return the previously-allocated channel back to the allocation pool.
"""
self.channelAllocator.free(channel)
def setEventLogHost(self, host, port=7197):
"""
Set the target host for Event Logger messaging. This should be pointed