satisfeet / hoopoe-old

Hoopoe is the REST API service for satisfeet.
1 stars 0 forks source link

redesign storage layer #41

Closed bodokaiser closed 10 years ago

bodokaiser commented 10 years ago

Fixes #15 and #37. Interface design happens here.

Current design issues are:

bodokaiser commented 10 years ago

1. + 2. + 4. Taking a look at the smtp package from go it seems legit to put this all into the constructor. According to that example the constructor could look like:

func NewXYStore(s *mgo.Session) (*XYStore, error) {
    s := &XYStore{
        m: mongo.NewStore(s, XYConfig),
    }
    s.m.AddListener("preSomething", s.preSomething)

    return s, s.m.Index()
}

3. Could just be done by some func (s *XYStore) OpenFile(model interface{}) (io.ReadWriteCloser, error) handle?

5. + 6. ???

bodokaiser commented 10 years ago

Separate file store from document store? Yes. Requires good names, possible name store.DocumentStore and store.FileStore.

Regarding 3. we could use a special store.File type which has a Open() method. Needs some deeper thoughts as this may bring some overhead.

Also #30 suggests adding construct methods for the basic models store.Customer, store.Order, store.Product.

bodokaiser commented 10 years ago

New ideas:

bodokaiser commented 10 years ago

Discussion is proceeded in #42.