1
0
mirror of https://github.com/mainflux/mainflux.git synced 2025-04-28 13:48:49 +08:00
Darko Draskovic 2b393ad50f MF-237 - Add support for storing messages in MongoDB (#307)
* Add mongodb-writer

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Add official mongodb driver

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Move Connect to main.go

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Remove bson.NewDoc and write msg directly in db

Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>

* Add MongoDB writer tests

Signed-off-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>

* Update README.md

Signed-off-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>

* Add mongodb services compose to addons dir

Signed-off-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>

* Update docs

Signed-off-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>

* Update docs and tests

Refactor code.

Signed-off-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>

* Expose MetricsMiddleware to align writers with other services

Signed-off-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>

* Add logging middleware

Signed-off-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>

* Update load tests version

Signed-off-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>
2018-06-01 15:50:23 +02:00

56 lines
2.4 KiB
Go

// Copyright (C) MongoDB, Inc. 2017-present.
//
// Licensed under the Apache License, Version 2.0 (the "License"); you may
// not use this file except in compliance with the License. You may obtain
// a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
package internal
import (
"time"
"github.com/mongodb/mongo-go-driver/bson/objectid"
)
// IsMasterResult is the result of executing this
// ismaster command.
type IsMasterResult struct {
Arbiters []string `bson:"arbiters,omitempty"`
ArbiterOnly bool `bson:"arbiterOnly,omitempty"`
ElectionID objectid.ObjectID `bson:"electionId,omitempty"`
Hidden bool `bson:"hidden,omitempty"`
Hosts []string `bson:"hosts,omitempty"`
IsMaster bool `bson:"ismaster,omitempty"`
IsReplicaSet bool `bson:"isreplicaset,omitempty"`
LastWriteTimestamp time.Time `bson:"lastWriteDate,omitempty"`
MaxBSONObjectSize uint32 `bson:"maxBsonObjectSize,omitempty"`
MaxMessageSizeBytes uint32 `bson:"maxMessageSizeBytes,omitempty"`
MaxWriteBatchSize uint16 `bson:"maxWriteBatchSize,omitempty"`
Me string `bson:"me,omitempty"`
MaxWireVersion int32 `bson:"maxWireVersion,omitempty"`
MinWireVersion int32 `bson:"minWireVersion,omitempty"`
Msg string `bson:"msg,omitempty"`
OK int32 `bson:"ok"`
Passives []string `bson:"passives,omitempty"`
ReadOnly bool `bson:"readOnly,omitempty"`
Secondary bool `bson:"secondary,omitempty"`
SetName string `bson:"setName,omitempty"`
SetVersion uint32 `bson:"setVersion,omitempty"`
Tags map[string]string `bson:"tags,omitempty"`
}
// BuildInfoResult is the result of executing the
// buildInfo command.
type BuildInfoResult struct {
OK bool `bson:"ok"`
GitVersion string `bson:"gitVersion,omitempty"`
Version string `bson:"version,omitempty"`
VersionArray []uint8 `bson:"versionArray,omitempty"`
}
// GetLastErrorResult is the result of executing the
// getLastError command.
type GetLastErrorResult struct {
ConnectionID uint32 `bson:"connectionId"`
}