func (s *Store) DeleteReference(referenceType spi.ReferenceType, objectIRI, referenceIRI *url.URL) error {
	logger.Debugf("[%s] Deleting reference of type %s from object %s: %s",
		s.serviceName, referenceType, objectIRI, referenceIRI)
	if objectIRI == nil {
		return fmt.Errorf("nil object IRI")
	}
	if referenceIRI == nil {
		return fmt.Errorf("nil reference IRI")
	}
	return s.referenceStores[referenceType].delete(objectIRI, referenceIRI)
}
DeleteReference deletes the reference of the given type from the given actor.
package memstore
import (
	"fmt"
	"net/url"
	"sort"
	"sync"
	"github.com/trustbloc/edge-core/pkg/log"
	"github.com/trustbloc/orb/pkg/activitypub/store/spi"
	"github.com/trustbloc/orb/pkg/activitypub/store/storeutil"
	"github.com/trustbloc/orb/pkg/activitypub/vocab"
)
var logger = log.New("activitypub_memstore")
type Store struct {
	serviceName     string
	activityStore   *activityStore
	referenceStores map[spi.ReferenceType]*referenceStore
	actorStore      map[string]*vocab.ActorType
	mutex           sync.RWMutex
}
func New(serviceName string) *Store {
	return &Store{
		serviceName:   serviceName,
		activityStore: newActivitiesStore(),
		referenceStores: map[spi.ReferenceType]*referenceStore{
			spi.Inbox:        newReferenceStore(),
			spi.Outbox:       newReferenceStore(),
			spi.PublicOutbox: newReferenceStore(),
			spi.Follower:     newReferenceStore(),
			spi.Following:    newReferenceStore(),
			spi.Witness:      newReferenceStore(),
			spi.Witnessing:   newReferenceStore(),
			spi.Like:         newReferenceStore(),
			spi.Liked:        newReferenceStore(),
			spi.Share:        newReferenceStore(),
			spi.AnchorEvent:  newReferenceStore(),
		},
		actorStore: make(map[string]*vocab.ActorType),
	}
}
func (s *Store) PutActor(actor *vocab.ActorType) error {
	s.mutex.Lock()
	defer s.mutex.Unlock()
	logger.Debugf("[%s] Storing actor [%s]", s.serviceName, actor.ID())
	s.actorStore[actor.ID().String()] = actor
	return nil
}
func (s *Store) GetActor(iri *url.URL) (*vocab.ActorType, error) {
	s.mutex.RLock()
	defer s.mutex.RUnlock()
	logger.Debugf("[%s] Retrieving actor [%s]", s.serviceName, iri)
	a, ok := s.actorStore[iri.String()]
	if !ok {
		return nil, spi.ErrNotFound
	}
	return a, nil
}
func (s *Store) AddActivity(activity *vocab.ActivityType) error {
	logger.Debugf("[%s] Storing activity - Type: %s, ID: %s",
		s.serviceName, activity.Type(), activity.ID())
	return s.activityStore.add(activity)
}
func (s *Store) GetActivity(activityID *url.URL) (*vocab.ActivityType, error) {
	logger.Debugf("[%s] Retrieving activity - ID: %s", s.serviceName, activityID)
	return s.activityStore.get(activityID.String())
}
func (s *Store) QueryActivities(query *spi.Criteria, opts ...spi.QueryOpt) (spi.ActivityIterator, error) {
	logger.Debugf("[%s] Querying activities - Query: %+v", s.serviceName, query)
	if query.ReferenceType != "" && query.ObjectIRI != nil {
		return s.queryActivitiesByRef(query.ReferenceType, query, opts...)
	}
	return s.activityStore.query(query, opts...), nil
}
func (s *Store) AddReference(referenceType spi.ReferenceType, objectIRI *url.URL, referenceIRI *url.URL,
	refMetaDataOpts ...spi.RefMetadataOpt) error {
	logger.Debugf("[%s] Adding reference of type %s to object %s: %s",
		s.serviceName, referenceType, objectIRI, referenceIRI)
	if objectIRI == nil {
		return fmt.Errorf("nil object IRI")
	}
	if referenceIRI == nil {
		return fmt.Errorf("nil reference IRI")
	}
	return s.referenceStores[referenceType].add(objectIRI, referenceIRI)
}