Giter VIP home page Giter VIP logo

dfs-client's Introduction

Overview

This repo contains a client implementation of Distributed File System. It provides a library written in Go with a simple implementation in app.go for means of an example.

Setup Instructions

  1. Setup Go

    1. Install Go >=1.3.3

    2. Navigate to a directory that will contain your Go directory

    3. Create the folder hierarchy

       mkdir -p go/{src,bin,pkg}
      
    4. Set this directory to be your GOPATH environment variable from 3.

       export GOPATH="Your/go/directory"
      
    5. Export go/bin to your bath PATH

       export PATH=$PATH:$GOPATH/bin
      
  2. Download the code

     go get github.com/conorbrady/dfs-client
    

Using the library

Importing

import "github.com/conorbrady/dfs-client/dfs"

Connect to the file system

func Connect(
	authServAdd string, // Address for authentication server
	dirServAdd string, // Address for directory server
	username string, // Username for authentication with the AS
	password string, // Password for authentication with the AS
	caching bool // Enable file caching
) *DFS // Returns an instance that can be used to open files on the system

Open a file for read/write

func (d* DFS)Open(
	filename string // Filename of the file
) (*File, error) // Returns a file or nil and an error

Read a file

// Implements io.Reader Interface
func (f* File)Read(
	p []byte
) (n int, err error)

Write a file

// Implements io.Writer Interface
func (f* File)Write(
	p []byte
) (n int, err error)

Running the Sample

Install the code.

go install github.com/conorbrady/dfs-client

Once you have added go/bin to your PATH you can run the code from any directory. Command line options are:

Authentication Server Address

-AS <address>

This must be specified to be the address of an instance of the accompanying Distributed File System run in -mode AS

Directory Server Address

-DS <address>

This must be specified to be the address of an instance of the accompanying Distributed File System run in -mode DS

Caching Mode

-caching <0 or 1>

This either enables or disables caching on the system

dfs-client's People

Contributors

conorbrady avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.