Skip to content

Instantly share code, notes, and snippets.

@drhanlau
Created March 3, 2016 14:09
Show Gist options
  • Save drhanlau/f1f59ddddda12d9b6029 to your computer and use it in GitHub Desktop.
Save drhanlau/f1f59ddddda12d9b6029 to your computer and use it in GitHub Desktop.
File Server of Facade Pattern
class FileServer(Server):
def __init__(self):
'''actions required for initializing the file server'''
self.name = 'FileServer'
self.state = State.new
def boot(self):
print('booting the {}'.format(self))
'''actions required for booting the file server'''
self.state = State.running
def kill(self, restart=True):
print('Killing {}'.format(self))
'''actions required for killing the file server'''
self.state = State.restart if restart else State.zombie
def create_file(self, user, name, permissions):
'''check validity of permissions, user rights, etc.'''
print("trying to create the file '{}' for user '{}' with permissions {}".format(name, user, permissions))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment