Giter VIP home page Giter VIP logo

vetus's Introduction

vetus

A versioned json object store based on git (Currently in development)

Terms

  • name: the name of the collection, allows you to have multiple object stores one is always required
  • user: the name of the user accessing the document, if none is supplied a default user is used
  • branch: the branch to perform the operation on, if none is supplied the default master is used

npm install vetus

Require vetus

var vetus = require('vetus')({path: './localDirectory'})
  • the path is the local folder to use for disk storage

Save objects

vetus.collection({name: 'collection', user: 'user', branch: 'branch'}, function(collection) {
  // data object can have as many properties as you like, each property is saved as separate document
  collection.data.myObject = obj

  collection.save('Updated my object', function() {
    res.send('OK')
  })
})

Load objects

vetus.collection({ name: 'collection', user: 'user', branch: 'branch' }, function(collection) {
  collection.load(function() {
    res.json(collection.data.myObject)
  })
})

Branches

Branches are designed to be used globally rather than local/remote

Create a branch

Where master is the branch to create from

vetus.collection({name: 'collection', user: 'user', branch: 'master'}, function(collection) {
  collection.createBranch('my_branch', function() {
    res.send('OK')
  })
})

Get a list of branches

vetus.collection({name: 'collection', user:'user'}, function(collection) {
  collection.branchList(function(list) {
    res.json(list)
  })
})

Delete a branchList

vetus.collection({name: 'collection', user: 'user', branch: 'master'}, function(collection) {
  collection.deleteBranch('my_branch', function() {
    res.send('OK')
  })
})
  • Make sure collection branch is not the branch you want to delete
  • May be some issues with this currently as other users branches are removed when they load next (via fetch --prune)

Get History (beta)

  vetus.collection({name: 'collection', user: 'user', branch: 'master'}, function(collection) {
    collection.history(function(graph) {
      res.json(graph)
    })
  })
  • Returns an object graph that contains additional $history properties to show details of last update on each property/item

Planned Features

  • Object Graph History
  • Object Merge Resolution
  • Diff Branches
  • Better Logging (:D)

Things to maybe look at

  • Document Indexing (in collection?)
  • Merge of collections
  • Split collection
  • Cross collection search (maybe use index stuff? O_o)
  • Better define what collections are supposed to be used for

Collections

A collection is used to store multiple documents that version together, possibly later there should be a higher abstraction for documents that should be searchable together, this would allow for different document types to be stored. Don't really have to worry about this until search is implemented. This could just be a seperate vetus path tbh.

Contributors


Changelog

0.5.3

  • Load collection version by tag #46

0.5.2

  • Collection versions tag against base repo, not user repo #45

0.5.1

  • Added collection allVersions() function #44

0.5.0

  • Versioning support using git tags #43

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.