Beispiel #1
0
func (s *fdbSnapshot) Create() error {

	var mainSeq forestdb.SeqNum
	if s.committed {
		mainSeq = s.mainSeqNum
	} else {
		mainSeq = FORESTDB_INMEMSEQ
	}

	var err error
	t0 := time.Now()
	s.main, err = s.main.SnapshotOpen(mainSeq)
	if err != nil {
		logging.Errorf("ForestDBSnapshot::Open \n\tUnexpected Error "+
			"Opening Main DB Snapshot (%v) SeqNum %v %v", s.slice.Path(), mainSeq, err)
		return err
	}

	if s.committed {
		s.slice.idxStats.Timings.stHandleOpen.Put(time.Now().Sub(t0))
	} else {
		s.slice.idxStats.Timings.stSnapshotCreate.Put(time.Now().Sub(t0))
	}

	s.slice.IncrRef()
	platform.StoreInt32(&s.refCount, 1)

	return nil
}
Beispiel #2
0
func (v *BoolVal) Set(nv bool) {
	var x int32

	if nv {
		x = 1
	} else {
		x = 0
	}

	platform.StoreInt32(v.val, x)
}