コード例 #1
0
ファイル: master.py プロジェクト: abrady/gfs
	def __init__(self):
		self.log("master server start")
		s = net.listen_sock(settings.MASTER_CHUNK_PORT)
		self.chunksrv_server = net.PakServer(s,"master:chunksrv")

		s = net.listen_sock(settings.MASTER_CLIENT_PORT)
		self.client_server = net.PakServer(s,"master:clientsrv")
		
		# meta data
		fn = settings.MASTER_META_FNAME
		if(os.path.exists(fn)):
			self.meta = cPickle.load(open(fn,'rb'))
			self.log('meta(%s) loaded: ' % fn + str(self.meta))
		else:
			self.meta = Meta()
			self.log('making new meta %s: ' % fn + str(self.meta))

		# pak senders: things with network responses that might not
		# be able to send right away
		self.senders = []

		# connected chunkservers
		self.chunkservers = {}

		# guid of alterations
		self.max_mutate_id = 0

		# coroutines of in progress commits of appends, writes, etc. 
		self.pending_commits = []
コード例 #2
0
ファイル: master.py プロジェクト: liyinhgqw/gfs
    def __init__(self):
        self.log("master server start")
        s = net.listen_sock(settings.MASTER_CHUNK_PORT)
        self.chunksrv_server = net.PakServer(s, "master:chunksrv")

        s = net.listen_sock(settings.MASTER_CLIENT_PORT)
        self.client_server = net.PakServer(s, "master:clientsrv")

        # meta data
        fn = settings.MASTER_META_FNAME
        if (os.path.exists(fn)):
            self.meta = cPickle.load(open(fn, 'rb'))
            self.log('meta(%s) loaded: ' % fn + str(self.meta))
        else:
            self.meta = Meta()
            self.log('making new meta %s: ' % fn + str(self.meta))

        # pak senders: things with network responses that might not
        # be able to send right away
        self.senders = []

        # connected chunkservers
        self.chunkservers = {}

        # guid of alterations
        self.max_mutate_id = 0

        # coroutines of in progress commits of appends, writes, etc.
        self.pending_commits = []
コード例 #3
0
ファイル: chunkserver.py プロジェクト: abrady/gfs
    def __init__(self):
        """inits a chunkserver:
		- scan the chunkdir for chunks
		- connect to master
		- open client listening port
		"""
        global chunkservid
        self.data_sends = []
        self.senders = []
        self.pending_data = {}
        self.id = chunkservid
        self.log("chunkserver init")

        self.chunkdir = settings.CHUNK_DIR + str(chunkservid)
        # self.name = "chunk%i" % self.id
        chunkservid += 1

        if not os.path.exists(self.chunkdir):
            os.mkdir(self.chunkdir)

        self._load()

        self.client_port = settings.CHUNK_CLIENT_PORT
        settings.CHUNK_CLIENT_PORT += 1
        cs = net.listen_sock(self.client_port)
        self.client_server = net.PakServer(cs, self.chunkdir)

        self._master_connect()
コード例 #4
0
ファイル: chunkserver.py プロジェクト: liyinhgqw/gfs
    def __init__(self):
        """inits a chunkserver:
		- scan the chunkdir for chunks
		- connect to master
		- open client listening port
		"""
        global chunkservid
        self.data_sends = []
        self.senders = []
        self.pending_data = {}
        self.id = chunkservid
        self.log("chunkserver init")

        self.chunkdir = settings.CHUNK_DIR + str(chunkservid)
        #self.name = "chunk%i" % self.id
        chunkservid += 1

        if not os.path.exists(self.chunkdir):
            os.mkdir(self.chunkdir)

        self._load()

        self.client_port = settings.CHUNK_CLIENT_PORT
        settings.CHUNK_CLIENT_PORT += 1
        cs = net.listen_sock(self.client_port)
        self.client_server = net.PakServer(cs, self.chunkdir)

        self._master_connect()